home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / gpp-1_42.lha / g++-1.42.0 / expr.c < prev    next >
C/C++ Source or Header  |  1991-10-19  |  180KB  |  5,791 lines

  1. /* Convert tree expression to rtl instructions, for GNU compiler.
  2.    Copyright (C) 1988 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. #include "config.h"
  22. #include "rtl.h"
  23. #include "tree.h"
  24. #include "flags.h"
  25. #include "insn-flags.h"
  26. #include "insn-codes.h"
  27. #include "expr.h"
  28. #include "insn-config.h"
  29. #include "recog.h"
  30. #include "gvarargs.h"
  31. #include "typeclass.h"
  32.  
  33. /* Decide whether a function's arguments should be processed
  34.    from first to last or from last to first.  */
  35.  
  36. #ifdef STACK_GROWS_DOWNWARD
  37. #ifdef PUSH_ROUNDING
  38. #define PUSH_ARGS_REVERSED    /* If it's last to first */
  39. #endif
  40. #endif
  41.  
  42. /* Like STACK_BOUNDARY but in units of bytes, not bits.  */
  43. #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
  44.  
  45. /* If this is nonzero, we do not bother generating VOLATILE
  46.    around volatile memory references, and we are willing to
  47.    output indirect addresses.  If cse is to follow, we reject
  48.    indirect addresses so a useful potential cse is generated;
  49.    if it is used only once, instruction combination will produce
  50.    the same indirect address eventually.  */
  51. int cse_not_expected;
  52.  
  53. /* Nonzero to generate code for all the subroutines within an
  54.    expression before generating the upper levels of the expression.
  55.    Nowadays this is never zero.  */
  56. int do_preexpand_calls = 1;
  57.  
  58. /* Number of units that we should eventually pop off the stack.
  59.    These are the arguments to function calls that have already returned.  */
  60. int pending_stack_adjust;
  61.  
  62. /* Nonzero means stack pops must not be deferred, and deferred stack
  63.    pops must not be output.  It is nonzero inside a function call,
  64.    inside a conditional expression, inside a statement expression,
  65.    and in other cases as well.  */
  66. int inhibit_defer_pop;
  67.  
  68. /* A list of all cleanups which belong to the arguments of
  69.    function calls being expanded by expand_call.  */
  70. static tree cleanups_this_call;
  71.  
  72. /* Nonzero means current function may call alloca
  73.    as a subroutine.  (__builtin_alloca does not count.)  */
  74. int may_call_alloca;
  75.  
  76. extern void use_variable ();
  77. rtx store_expr ();
  78. static void store_constructor ();
  79. static rtx store_field ();
  80. static rtx expand_call ();
  81. static void emit_call_1 ();
  82. static rtx prepare_call_address ();
  83. static rtx expand_builtin ();
  84. static rtx compare ();
  85. static rtx compare_constants ();
  86. static rtx compare1 ();
  87. static rtx do_store_flag ();
  88. static void preexpand_calls ();
  89. static rtx expand_increment ();
  90. static void init_queue ();
  91.  
  92. void do_pending_stack_adjust ();
  93.  
  94. /* MOVE_RATIO is the number of move instructions that is better than
  95.    a block move.  */
  96.  
  97. #ifndef MOVE_RATIO
  98. #if defined (HAVE_movstrqi) || defined (HAVE_movstrhi) || defined (HAVE_movstrsi)
  99. #define MOVE_RATIO 2
  100. #else
  101. /* A value of around 6 would minimize code size; infinity would minimize
  102.    execution time.  */
  103. #define MOVE_RATIO 15
  104. #endif
  105. #endif
  106.  
  107. /* Table indexed by tree code giving 1 if the code is for a
  108.    comparison operation, or anything that is most easily
  109.    computed with a conditional branch.
  110.  
  111.    We include tree.def to give it the proper length.
  112.    The contents thus created are irrelevant.
  113.    The real contents are initialized in init_comparisons.  */
  114.  
  115. #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) 0,
  116.  
  117. static char comparison_code[] = {
  118. #include "tree.def"
  119. };
  120. #undef DEFTREECODE
  121.  
  122. /* This is run once per compilation.  */
  123.  
  124. void
  125. init_comparisons ()
  126. {
  127.   comparison_code[(int) EQ_EXPR] = 1;
  128.   comparison_code[(int) NE_EXPR] = 1;
  129.   comparison_code[(int) LT_EXPR] = 1;
  130.   comparison_code[(int) GT_EXPR] = 1;
  131.   comparison_code[(int) LE_EXPR] = 1;
  132.   comparison_code[(int) GE_EXPR] = 1;
  133. }
  134.  
  135. /* This is run at the start of compiling a function.  */
  136.  
  137. void
  138. init_expr ()
  139. {
  140.   init_queue ();
  141.   may_call_alloca = 0;
  142. }
  143.  
  144. /* Manage the queue of increment instructions to be output
  145.    for POSTINCREMENT_EXPR expressions, etc.  */
  146.  
  147. static rtx pending_chain;
  148.  
  149. /* Queue up to increment (or change) VAR later.  BODY says how:
  150.    BODY should be the same thing you would pass to emit_insn
  151.    to increment right away.  It will go to emit_insn later on.
  152.  
  153.    The value is a QUEUED expression to be used in place of VAR
  154.    where you want to guarantee the pre-incrementation value of VAR.  */
  155.  
  156. static rtx
  157. enqueue_insn (var, body)
  158.      rtx var, body;
  159. {
  160.   pending_chain = gen_rtx (QUEUED, GET_MODE (var),
  161.                var, 0, 0, body, pending_chain);
  162.   return pending_chain;
  163. }
  164.  
  165. /* Use protect_from_queue to convert a QUEUED expression
  166.    into something that you can put immediately into an instruction.
  167.    If the queued incrementation has not happened yet,
  168.    protect_from_queue returns the variable itself.
  169.    If the incrementation has happened, protect_from_queue returns a temp
  170.    that contains a copy of the old value of the variable.
  171.  
  172.    Any time an rtx which might possibly be a QUEUED is to be put
  173.    into an instruction, it must be passed through protect_from_queue first.
  174.    QUEUED expressions are not meaningful in instructions.
  175.  
  176.    Do not pass a value through protect_from_queue and then hold
  177.    on to it for a while before putting it in an instruction!
  178.    If the queue is flushed in between, incorrect code will result.  */
  179.  
  180. rtx
  181. protect_from_queue (x, modify)
  182.      register rtx x;
  183.      int modify;
  184. {
  185.   register RTX_CODE code = GET_CODE (x);
  186.  
  187.   if (code != QUEUED)
  188.     {
  189.       /* A special hack for read access to (MEM (QUEUED ...))
  190.      to facilitate use of autoincrement.
  191.      Make a copy of the contents of the memory location
  192.      rather than a copy of the address, but not
  193.      if the value is of mode BLKmode.  */
  194.       if (code == MEM && GET_MODE (x) != BLKmode
  195.       && GET_CODE (XEXP (x, 0)) == QUEUED && !modify)
  196.     {
  197.       register rtx y = XEXP (x, 0);
  198.       XEXP (x, 0) = QUEUED_VAR (y);
  199.       if (QUEUED_INSN (y))
  200.         {
  201.           register rtx temp = gen_reg_rtx (GET_MODE (x));
  202.           emit_insn_before (gen_move_insn (temp, x),
  203.                 QUEUED_INSN (y));
  204.           return temp;
  205.         }
  206.       return x;
  207.     }
  208.       /* Otherwise, recursively protect the subexpressions of all
  209.      the kinds of rtx's that can contain a QUEUED.  */
  210.       if (code == MEM)
  211.     XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
  212.       else if (code == PLUS || code == MULT)
  213.     {
  214.       XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
  215.       XEXP (x, 1) = protect_from_queue (XEXP (x, 1), 0);
  216.     }
  217.       return x;
  218.     }
  219.   /* If the increment has not happened, use the variable itself.  */
  220.   if (QUEUED_INSN (x) == 0)
  221.     return QUEUED_VAR (x);
  222.   /* If the increment has happened and a pre-increment copy exists,
  223.      use that copy.  */
  224.   if (QUEUED_COPY (x) != 0)
  225.     return QUEUED_COPY (x);
  226.   /* The increment has happened but we haven't set up a pre-increment copy.
  227.      Set one up now, and use it.  */
  228.   QUEUED_COPY (x) = gen_reg_rtx (GET_MODE (QUEUED_VAR (x)));
  229.   emit_insn_before (gen_move_insn (QUEUED_COPY (x), QUEUED_VAR (x)),
  230.             QUEUED_INSN (x));
  231.   return QUEUED_COPY (x);
  232. }
  233.  
  234. /* Return nonzero if X contains a QUEUED expression:
  235.    if it contains anything that will be altered by a queued increment.
  236.    We handle only combinations of MEM, PLUS, MINUS and MULT operators
  237.    since memory addresses generally contain only those.  */
  238.  
  239. static int
  240. queued_subexp_p (x)
  241.      rtx x;
  242. {
  243.   register enum rtx_code code = GET_CODE (x);
  244.   switch (code)
  245.     {
  246.     case QUEUED:
  247.       return 1;
  248.     case MEM:
  249.       return queued_subexp_p (XEXP (x, 0));
  250.     case MULT:
  251.     case PLUS:
  252.     case MINUS:
  253.       return queued_subexp_p (XEXP (x, 0))
  254.     || queued_subexp_p (XEXP (x, 1));
  255.     }
  256.   return 0;
  257. }
  258.  
  259. /* Perform all the pending incrementations.  */
  260.  
  261. void
  262. emit_queue ()
  263. {
  264.   register rtx p;
  265.   while (p = pending_chain)
  266.     {
  267.       QUEUED_INSN (p) = emit_insn (QUEUED_BODY (p));
  268.       pending_chain = QUEUED_NEXT (p);
  269.     }
  270. }
  271.  
  272. static void
  273. init_queue ()
  274. {
  275.   if (pending_chain)
  276.     abort ();
  277. }
  278.  
  279. /* Copy data from FROM to TO, where the machine modes are not the same.
  280.    Both modes may be integer, or both may be floating.
  281.    UNSIGNEDP should be nonzero if FROM is an unsigned type.
  282.    This causes zero-extension instead of sign-extension.  */
  283.  
  284. void
  285. convert_move (to, from, unsignedp)
  286.      register rtx to, from;
  287.      int unsignedp;
  288. {
  289.   enum machine_mode to_mode = GET_MODE (to);
  290.   enum machine_mode from_mode = GET_MODE (from);
  291.   int to_real = GET_MODE_CLASS (to_mode) == MODE_FLOAT;
  292.   int from_real = GET_MODE_CLASS (from_mode) == MODE_FLOAT;
  293.   int extending = (int) to_mode > (int) from_mode;
  294.  
  295.   to = protect_from_queue (to, 1);
  296.   from = protect_from_queue (from, 0);
  297.  
  298.   if (to_real != from_real)
  299.     abort ();
  300.  
  301.   if (to_mode == from_mode
  302.       || (from_mode == VOIDmode && CONSTANT_P (from)))
  303.     {
  304.       emit_move_insn (to, from);
  305.       return;
  306.     }
  307.  
  308.   if (to_real)
  309.     {
  310. #ifdef HAVE_extendsfdf2
  311.       if (HAVE_extendsfdf2 && extending)
  312.     {
  313.       emit_unop_insn (CODE_FOR_extendsfdf2, to, from, UNKNOWN);
  314.       return;
  315.     }
  316. #endif
  317. #ifdef HAVE_truncdfsf2
  318.       if (HAVE_truncdfsf2 && ! extending)
  319.     {
  320.       emit_unop_insn (CODE_FOR_truncdfsf2, to, from, UNKNOWN);
  321.       return;
  322.     }
  323. #endif
  324.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, (extending
  325.                               ? "__extendsfdf2"
  326.                               : "__truncdfsf2")), 0,
  327.              GET_MODE (to), 1,
  328.              from,  (extending ? SFmode : DFmode));
  329.       emit_move_insn (to, hard_libcall_value (GET_MODE (to)));
  330.       return;
  331.     }
  332.  
  333.   /* Now both modes are integers.  */
  334.  
  335.   if (to_mode == DImode)
  336.     {
  337.       if (unsignedp)
  338.     {
  339. #ifdef HAVE_zero_extendsidi2
  340.       if (HAVE_zero_extendsidi2 && from_mode == SImode)
  341.         emit_unop_insn (CODE_FOR_zero_extendsidi2, to, from, ZERO_EXTEND);
  342.       else
  343. #endif
  344. #ifdef HAVE_zero_extendhidi2
  345.       if (HAVE_zero_extendhidi2 && from_mode == HImode)
  346.         emit_unop_insn (CODE_FOR_zero_extendhidi2, to, from, ZERO_EXTEND);
  347.       else
  348. #endif
  349. #ifdef HAVE_zero_extendqidi2
  350.       if (HAVE_zero_extendqidi2 && from_mode == QImode)
  351.         emit_unop_insn (CODE_FOR_zero_extendqidi2, to, from, ZERO_EXTEND);
  352.       else
  353. #endif
  354. #ifdef HAVE_zero_extendsidi2
  355.       if (HAVE_zero_extendsidi2)
  356.         {
  357.           convert_move (gen_lowpart (SImode, to), from, unsignedp);
  358.           emit_unop_insn (CODE_FOR_zero_extendsidi2, to,
  359.                   gen_lowpart (SImode, to), ZERO_EXTEND);
  360.         }
  361.       else
  362. #endif
  363.         {
  364.           emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
  365.           convert_move (gen_lowpart (SImode, to), from, unsignedp);
  366.           emit_clr_insn (gen_highpart (SImode, to));
  367.         }
  368.     }
  369. #ifdef HAVE_extendsidi2
  370.       else if (HAVE_extendsidi2 && from_mode == SImode)
  371.     emit_unop_insn (CODE_FOR_extendsidi2, to, from, SIGN_EXTEND);
  372. #endif
  373. #ifdef HAVE_extendhidi2
  374.       else if (HAVE_extendhidi2 && from_mode == HImode)
  375.     emit_unop_insn (CODE_FOR_extendhidi2, to, from, SIGN_EXTEND);
  376. #endif
  377. #ifdef HAVE_extendqidi2
  378.       else if (HAVE_extendqidi2 && from_mode == QImode)
  379.     emit_unop_insn (CODE_FOR_extendqidi2, to, from, SIGN_EXTEND);
  380. #endif
  381. #ifdef HAVE_extendsidi2
  382.       else if (HAVE_extendsidi2)
  383.     {
  384.       convert_move (gen_lowpart (SImode, to), from, unsignedp);
  385.       emit_unop_insn (CODE_FOR_extendsidi2, to,
  386.               gen_lowpart (SImode, to), SIGN_EXTEND);
  387.     }
  388. #endif
  389. #ifdef HAVE_slt
  390.       else if (HAVE_slt && insn_operand_mode[(int) CODE_FOR_slt][0] == SImode)
  391.     {
  392.       emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
  393.       convert_move (gen_lowpart (SImode, to), from, unsignedp);
  394.       emit_insn (gen_slt (gen_highpart (SImode, to)));
  395.     }
  396. #endif
  397.       else
  398.     {
  399.       register rtx label = gen_label_rtx ();
  400.  
  401.       emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
  402.       emit_clr_insn (gen_highpart (SImode, to));
  403.       convert_move (gen_lowpart (SImode, to), from, unsignedp);
  404.       emit_cmp_insn (gen_lowpart (SImode, to),
  405.              gen_rtx (CONST_INT, VOIDmode, 0),
  406.              0, 0, 0);
  407.       NO_DEFER_POP;
  408.       emit_jump_insn (gen_bge (label));
  409.       expand_unop (SImode, one_cmpl_optab,
  410.                gen_highpart (SImode, to), gen_highpart (SImode, to),
  411.                1);
  412.       emit_label (label);
  413.       OK_DEFER_POP;
  414.     }
  415.       return;
  416.     }
  417.  
  418.   if (from_mode == DImode)
  419.     {
  420.       convert_move (to, gen_lowpart (SImode, from), 0);
  421.       return;
  422.     }
  423.  
  424.   /* Now follow all the conversions between integers
  425.      no more than a word long.  */
  426.  
  427.   /* For truncation, usually we can just refer to FROM in a narrower mode.  */
  428.   if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode)
  429.       && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (to_mode),
  430.                 GET_MODE_BITSIZE (from_mode))
  431.       && ((GET_CODE (from) == MEM
  432.        && ! MEM_VOLATILE_P (from)
  433.        && ! mode_dependent_address_p (XEXP (from, 0)))
  434.       || GET_CODE (from) == REG
  435.       || GET_CODE (from) == SUBREG))
  436.     {
  437.       emit_move_insn (to, gen_lowpart (to_mode, from));
  438.       return;
  439.     }
  440.  
  441.   if (to_mode == SImode && from_mode == HImode)
  442.     {
  443.       if (unsignedp)
  444.     {
  445. #ifdef HAVE_zero_extendhisi2
  446.       if (HAVE_zero_extendhisi2)
  447.         emit_unop_insn (CODE_FOR_zero_extendhisi2, to, from, ZERO_EXTEND);
  448.       else
  449. #endif
  450.         abort ();
  451.     }
  452.       else
  453.     {
  454. #ifdef HAVE_extendhisi2
  455.       if (HAVE_extendhisi2)
  456.         emit_unop_insn (CODE_FOR_extendhisi2, to, from, SIGN_EXTEND);
  457.       else
  458. #endif
  459.         abort ();
  460.     }
  461.       return;
  462.     }
  463.  
  464.   if (to_mode == SImode && from_mode == QImode)
  465.     {
  466.       if (unsignedp)
  467.     {
  468. #ifdef HAVE_zero_extendqisi2
  469.       if (HAVE_zero_extendqisi2)
  470.         {
  471.           emit_unop_insn (CODE_FOR_zero_extendqisi2, to, from, ZERO_EXTEND);
  472.           return;
  473.         }
  474. #endif
  475. #if defined (HAVE_zero_extendqihi2) && defined (HAVE_extendhisi2)
  476.       if (HAVE_zero_extendqihi2 && HAVE_extendhisi2)
  477.         {
  478.           register rtx temp = gen_reg_rtx (HImode);
  479.           emit_unop_insn (CODE_FOR_zero_extendqihi2, temp, from, ZERO_EXTEND);
  480.           emit_unop_insn (CODE_FOR_extendhisi2, to, temp, SIGN_EXTEND);
  481.           return;
  482.         }
  483. #endif
  484.     }
  485.       else
  486.     {
  487. #ifdef HAVE_extendqisi2
  488.       if (HAVE_extendqisi2)
  489.         {
  490.           emit_unop_insn (CODE_FOR_extendqisi2, to, from, SIGN_EXTEND);
  491.           return;
  492.         }
  493. #endif
  494. #if defined (HAVE_extendqihi2) && defined (HAVE_extendhisi2)
  495.       if (HAVE_extendqihi2 && HAVE_extendhisi2)
  496.         {
  497.           register rtx temp = gen_reg_rtx (HImode);
  498.           emit_unop_insn (CODE_FOR_extendqihi2, temp, from, SIGN_EXTEND);
  499.           emit_unop_insn (CODE_FOR_extendhisi2, to, temp, SIGN_EXTEND);
  500.           return;
  501.         }
  502. #endif
  503.     }
  504.       abort ();
  505.     }
  506.  
  507.   if (to_mode == HImode && from_mode == QImode)
  508.     {
  509.       if (unsignedp)
  510.     {
  511. #ifdef HAVE_zero_extendqihi2
  512.       if (HAVE_zero_extendqihi2)
  513.         {
  514.           emit_unop_insn (CODE_FOR_zero_extendqihi2, to, from, ZERO_EXTEND);
  515.           return;
  516.         }
  517. #endif
  518.     }
  519.       else
  520.     {
  521. #ifdef HAVE_extendqihi2
  522.       if (HAVE_extendqihi2)
  523.         {
  524.           emit_unop_insn (CODE_FOR_extendqihi2, to, from, SIGN_EXTEND);
  525.           return;
  526.         }
  527. #endif
  528.     }
  529.       abort ();
  530.     }
  531.  
  532. #if 0 /* This seems to be redundant with code 100 lines up.  */
  533.  
  534.   /* Now we are truncating an integer to a smaller one.
  535.      If the result is a temporary, we might as well just copy it,
  536.      since only the low-order part of the result needs to be valid
  537.      and it is valid with no change.  */
  538.  
  539.   if (GET_CODE (to) == REG)
  540.     {
  541.       if (GET_CODE (from) == REG)
  542.     {
  543.       emit_move_insn (to, gen_lowpart (GET_MODE (to), from));
  544.       return;
  545.     }
  546.       else if (GET_CODE (from) == SUBREG)
  547.     {
  548.       from = copy_rtx (from);
  549.       /* This is safe since FROM is not more than one word.  */
  550.       PUT_MODE (from, GET_MODE (to));
  551.       emit_move_insn (to, from);
  552.       return;
  553.     }
  554. #ifndef BYTES_BIG_ENDIAN
  555.       else if (GET_CODE (from) == MEM)
  556.     {
  557.       register rtx addr = XEXP (from, 0);
  558.       if (memory_address_p (GET_MODE (to), addr))
  559.         {
  560.           emit_move_insn (to, gen_rtx (MEM, GET_MODE (to), addr));
  561.           return;
  562.         }
  563.     }
  564. #endif /* not BYTES_BIG_ENDIAN */
  565.     }
  566. #endif /* 0 */
  567.  
  568.   if (from_mode == SImode && to_mode == HImode)
  569.     {
  570. #ifdef HAVE_truncsihi2
  571.       if (HAVE_truncsihi2)
  572.     {
  573.       emit_unop_insn (CODE_FOR_truncsihi2, to, from, UNKNOWN);
  574.       return;
  575.     }
  576. #endif
  577.       abort ();
  578.     }
  579.  
  580.   if (from_mode == SImode && to_mode == QImode)
  581.     {
  582. #ifdef HAVE_truncsiqi2
  583.       if (HAVE_truncsiqi2)
  584.     {
  585.       emit_unop_insn (CODE_FOR_truncsiqi2, to, from, UNKNOWN);
  586.       return;
  587.     }
  588. #endif
  589.       abort ();
  590.     }
  591.  
  592.   if (from_mode == HImode && to_mode == QImode)
  593.     {
  594. #ifdef HAVE_trunchiqi2
  595.       if (HAVE_trunchiqi2)
  596.     {
  597.       emit_unop_insn (CODE_FOR_trunchiqi2, to, from, UNKNOWN);
  598.       return;
  599.     }
  600. #endif
  601.       abort ();
  602.     }
  603.  
  604.   /* Mode combination is not recognized.  */
  605.   abort ();
  606. }
  607.  
  608. /* Return an rtx for a value that would result
  609.    from converting X to mode MODE.
  610.    Both X and MODE may be floating, or both integer.
  611.    UNSIGNEDP is nonzero if X is an unsigned value.
  612.    This can be done by referring to a part of X in place
  613.    or by copying to a new temporary with conversion.  */
  614.  
  615. rtx
  616. convert_to_mode (mode, x, unsignedp)
  617.      enum machine_mode mode;
  618.      rtx x;
  619.      int unsignedp;
  620. {
  621.   register rtx temp;
  622.   if (mode == GET_MODE (x))
  623.     return x;
  624.   if (integer_mode_p (mode)
  625.       && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (x))
  626.       && ! (GET_CODE (x) == MEM && MEM_VOLATILE_P (x)))
  627.     return gen_lowpart (mode, x);
  628.   temp = gen_reg_rtx (mode);
  629.   convert_move (temp, x, unsignedp);
  630.   return temp;
  631. }
  632.  
  633. int
  634. integer_mode_p (mode)
  635.      enum machine_mode mode;
  636. {
  637.   return (int) mode > (int) VOIDmode && (int) mode <= (int) TImode;
  638. }
  639.  
  640. /* Generate several move instructions to copy LEN bytes
  641.    from block FROM to block TO.  (These are MEM rtx's with BLKmode).
  642.    The caller must pass FROM and TO
  643.     through protect_from_queue before calling.
  644.    ALIGN (in bytes) is maximum alignment we can assume.  */
  645.  
  646. struct move_by_pieces
  647. {
  648.   rtx to;
  649.   rtx to_addr;
  650.   int autinc_to;
  651.   int explicit_inc_to;
  652.   rtx from;
  653.   rtx from_addr;
  654.   int autinc_from;
  655.   int explicit_inc_from;
  656.   int len;
  657.   int offset;
  658.   int reverse;
  659. };
  660.  
  661. static void move_by_pieces_1 ();
  662. static int move_by_pieces_ninsns ();
  663.  
  664. static void
  665. move_by_pieces (to, from, len, align)
  666.      rtx to, from;
  667.      int len, align;
  668. {
  669.   struct move_by_pieces data;
  670.   rtx to_addr = XEXP (to, 0), from_addr = XEXP (from, 0);
  671.  
  672.   data.offset = 0;
  673.   data.to_addr = to_addr;
  674.   data.from_addr = from_addr;
  675.   data.to = to;
  676.   data.from = from;
  677.   data.autinc_to
  678.     = (GET_CODE (to_addr) == PRE_INC || GET_CODE (to_addr) == PRE_DEC
  679.        || GET_CODE (to_addr) == POST_INC || GET_CODE (to_addr) == POST_DEC);
  680.   data.autinc_from
  681.     = (GET_CODE (from_addr) == PRE_INC || GET_CODE (from_addr) == PRE_DEC
  682.        || GET_CODE (from_addr) == POST_INC
  683.        || GET_CODE (from_addr) == POST_DEC);
  684.  
  685.   data.explicit_inc_from = 0;
  686.   data.explicit_inc_to = 0;
  687.   data.reverse
  688.     = (GET_CODE (to_addr) == PRE_DEC || GET_CODE (to_addr) == POST_DEC);
  689.   if (data.reverse) data.offset = len;
  690.   data.len = len;
  691.  
  692.   /* If copying requires more than two move insns,
  693.      copy addresses to registers (to make displacements shorter)
  694.      and use post-increment if available.  */
  695.   if (!(data.autinc_from && data.autinc_to)
  696.       && move_by_pieces_ninsns (len, align) > 2)
  697.     {
  698. #ifdef HAVE_PRE_DECREMENT
  699.       if (data.reverse && ! data.autinc_from)
  700.     {
  701.       data.from_addr = copy_addr_to_reg (plus_constant (from_addr, len));
  702.       data.autinc_from = 1;
  703.       data.explicit_inc_from = -1;
  704.     }
  705. #endif
  706. #ifdef HAVE_POST_INCREMENT
  707.       if (! data.autinc_from)
  708.     {
  709.       data.from_addr = copy_addr_to_reg (from_addr);
  710.       data.autinc_from = 1;
  711.       data.explicit_inc_from = 1;
  712.     }
  713. #endif
  714.       if (!data.autinc_from && CONSTANT_P (from_addr))
  715.     data.from_addr = copy_addr_to_reg (from_addr);
  716. #ifdef HAVE_PRE_DECREMENT
  717.       if (data.reverse && ! data.autinc_to)
  718.     {
  719.       data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
  720.       data.autinc_to = 1;
  721.       data.explicit_inc_to = -1;
  722.     }
  723. #endif
  724. #ifdef HAVE_POST_INCREMENT
  725.       if (! data.reverse && ! data.autinc_to)
  726.     {
  727.       data.to_addr = copy_addr_to_reg (to_addr);
  728.       data.autinc_to = 1;
  729.       data.explicit_inc_to = 1;
  730.     }
  731. #endif
  732.       if (!data.autinc_to && CONSTANT_P (to_addr))
  733.     data.to_addr = copy_addr_to_reg (to_addr);
  734.     }
  735.  
  736. #ifdef STRICT_ALIGNMENT
  737.   if (align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
  738.     align = MOVE_MAX;
  739. #else
  740.   align = MOVE_MAX;
  741. #endif
  742.  
  743. #ifdef HAVE_movti
  744.   if (HAVE_movti && align >= GET_MODE_SIZE (TImode))
  745.     move_by_pieces_1 (gen_movti, TImode, &data);
  746. #endif
  747. #ifdef HAVE_movdi
  748.   if (HAVE_movdi && align >= GET_MODE_SIZE (DImode))
  749.     move_by_pieces_1 (gen_movdi, DImode, &data);
  750. #endif
  751. #ifdef HAVE_movsi
  752.   if (align >= GET_MODE_SIZE (SImode))
  753.     move_by_pieces_1 (gen_movsi, SImode, &data);
  754. #endif
  755. #ifdef HAVE_movhi
  756.   if (HAVE_movhi && align >= GET_MODE_SIZE (HImode))
  757.     move_by_pieces_1 (gen_movhi, HImode, &data);
  758. #endif
  759. #ifdef HAVE_movqi
  760.   move_by_pieces_1 (gen_movqi, QImode, &data);
  761. #else
  762.   movqi instruction required in machine description
  763. #endif
  764. }
  765.  
  766. /* Return number of insns required to move L bytes by pieces.
  767.    ALIGN (in bytes) is maximum alignment we can assume.  */
  768.  
  769. static int
  770. move_by_pieces_ninsns (l, align)
  771.      unsigned int l;
  772.      int align;
  773. {
  774.   register int n_insns = 0;
  775.  
  776. #ifdef STRICT_ALIGNMENT
  777.   if (align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
  778.     align = MOVE_MAX;
  779. #else
  780.   align = MOVE_MAX;
  781. #endif
  782.  
  783. #ifdef HAVE_movti
  784.   if (HAVE_movti && align >= GET_MODE_SIZE (TImode))
  785.     n_insns += l / GET_MODE_SIZE (TImode), l %= GET_MODE_SIZE (TImode);
  786. #endif
  787. #ifdef HAVE_movdi
  788.   if (HAVE_movdi && align >= GET_MODE_SIZE (DImode))
  789.     n_insns += l / GET_MODE_SIZE (DImode), l %= GET_MODE_SIZE (DImode);
  790. #endif
  791. #ifdef HAVE_movsi
  792.   if (HAVE_movsi && align >= GET_MODE_SIZE (SImode))
  793.     n_insns += l / GET_MODE_SIZE (SImode), l %= GET_MODE_SIZE (SImode);
  794. #endif
  795. #ifdef HAVE_movhi
  796.   if (HAVE_movhi && align >= GET_MODE_SIZE (HImode))
  797.     n_insns += l / GET_MODE_SIZE (HImode), l %= GET_MODE_SIZE (HImode);
  798. #endif
  799.   n_insns += l;
  800.  
  801.   return n_insns;
  802. }
  803.  
  804. /* Subroutine of move_by_pieces.  Move as many bytes as appropriate
  805.    with move instructions for mode MODE.  GENFUN is the gen_... function
  806.    to make a move insn for that mode.  DATA has all the other info.  */
  807.  
  808. static void
  809. move_by_pieces_1 (genfun, mode, data)
  810.      rtx (*genfun) ();
  811.      enum machine_mode mode;
  812.      struct move_by_pieces *data;
  813. {
  814.   register int size = GET_MODE_SIZE (mode);
  815.   register rtx to1, from1;
  816.  
  817.   while (data->len >= size)
  818.     {
  819.       if (data->reverse) data->offset -= size;
  820.  
  821.       to1 = (data->autinc_to
  822.          ? gen_rtx (MEM, mode, data->to_addr)
  823.          : change_address (data->to, mode,
  824.                    plus_constant (data->to_addr, data->offset)));
  825.       from1 =
  826.     (data->autinc_from
  827.      ? gen_rtx (MEM, mode, data->from_addr)
  828.      : change_address (data->from, mode,
  829.                plus_constant (data->from_addr, data->offset)));
  830.  
  831. #ifdef HAVE_PRE_DECREMENT
  832.       if (data->explicit_inc_to < 0)
  833.     emit_insn (gen_sub2_insn (data->to_addr,
  834.                   gen_rtx (CONST_INT, VOIDmode, size)));
  835.       if (data->explicit_inc_from < 0)
  836.     emit_insn (gen_sub2_insn (data->from_addr,
  837.                   gen_rtx (CONST_INT, VOIDmode, size)));
  838. #endif
  839.  
  840.       emit_insn ((*genfun) (to1, from1));
  841. #ifdef HAVE_POST_INCREMENT
  842.       if (data->explicit_inc_to > 0)
  843.     emit_insn (gen_add2_insn (data->to_addr,
  844.                   gen_rtx (CONST_INT, VOIDmode, size)));
  845.       if (data->explicit_inc_from > 0)
  846.     emit_insn (gen_add2_insn (data->from_addr,
  847.                   gen_rtx (CONST_INT, VOIDmode, size)));
  848. #endif
  849.  
  850.       if (! data->reverse) data->offset += size;
  851.  
  852.       data->len -= size;
  853.     }
  854. }
  855.  
  856. /* Emit code to move a block Y to a block X.
  857.    This may be done with string-move instructions,
  858.    with multiple scalar move instructions, or with a library call.
  859.  
  860.    Both X and Y must be MEM rtx's (perhaps inside VOLATILE)
  861.    with mode BLKmode.
  862.    SIZE is an rtx that says how long they are.
  863.    ALIGN is the maximum alignment we can assume they have,
  864.    measured in bytes.  */
  865.  
  866. void
  867. emit_block_move (x, y, size, align)
  868.      rtx x, y;
  869.      rtx size;
  870.      int align;
  871. {
  872.   if (GET_MODE (x) != BLKmode)
  873.     abort ();
  874.  
  875.   if (GET_MODE (y) != BLKmode)
  876.     abort ();
  877.  
  878.   x = protect_from_queue (x, 1);
  879.   y = protect_from_queue (y, 0);
  880.  
  881.   if (GET_CODE (x) != MEM)
  882.     abort ();
  883.   if (GET_CODE (y) != MEM)
  884.     abort ();
  885.   if (size == 0)
  886.     abort ();
  887.  
  888.   if (GET_CODE (size) == CONST_INT
  889.       && (move_by_pieces_ninsns ((unsigned) INTVAL (size), align)
  890.       < MOVE_RATIO))
  891.     move_by_pieces (x, y, INTVAL (size), align);
  892.   else
  893.     {
  894.       /* Try the most limited insn first, because there's no point
  895.      including more than one in the machine description unless
  896.      the more limited one has some advantage.  */
  897. #ifdef HAVE_movstrqi
  898.       if (HAVE_movstrqi
  899.       && GET_CODE (size) == CONST_INT
  900.       && ((unsigned) INTVAL (size)
  901.           < (1 << (GET_MODE_BITSIZE (QImode) - 1))))
  902.     {
  903.       emit_insn (gen_movstrqi (x, y, size,
  904.                    gen_rtx (CONST_INT, VOIDmode, align)));
  905.       return;
  906.     }
  907. #endif
  908. #ifdef HAVE_movstrhi
  909.       if (HAVE_movstrhi
  910.       && GET_CODE (size) == CONST_INT
  911.       && ((unsigned) INTVAL (size)
  912.           < (1 << (GET_MODE_BITSIZE (HImode) - 1))))
  913.     {
  914.       emit_insn (gen_movstrhi (x, y, size,
  915.                    gen_rtx (CONST_INT, VOIDmode, align)));
  916.       return;
  917.     }
  918. #endif
  919. #ifdef HAVE_movstrsi
  920.       if (HAVE_movstrsi)
  921.     {
  922.       emit_insn (gen_movstrsi (x, y, size,
  923.                    gen_rtx (CONST_INT, VOIDmode, align)));
  924.       return;
  925.     }
  926. #endif
  927.  
  928. #ifdef TARGET_MEM_FUNCTIONS
  929.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"), 0,
  930.              VOIDmode, 3, XEXP (x, 0), Pmode,
  931.              XEXP (y, 0), Pmode,
  932.              size, Pmode);
  933. #else
  934.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcopy"), 0,
  935.              VOIDmode, 3, XEXP (y, 0), Pmode,
  936.              XEXP (x, 0), Pmode,
  937.              size, Pmode);
  938. #endif
  939.     }
  940. }
  941.  
  942. /* Copy all or part of a BLKmode value X into registers starting at REGNO.
  943.    The number of registers to be filled is NREGS.  */
  944.  
  945. void
  946. move_block_to_reg (regno, x, nregs)
  947.      int regno;
  948.      rtx x;
  949.      int nregs;
  950. {
  951.   int i;
  952.   if (GET_CODE (x) == CONST_DOUBLE && x != dconst0_rtx)
  953.     x = force_const_double_mem (x);
  954.   for (i = 0; i < nregs; i++)
  955.     {
  956.       if (GET_CODE (x) == REG)
  957.     emit_move_insn (gen_rtx (REG, SImode, regno + i),
  958.             gen_rtx (SUBREG, SImode, x, i));
  959.       else if (x == dconst0_rtx)
  960.     emit_move_insn (gen_rtx (REG, SImode, regno + i),
  961.             const0_rtx);
  962.       else
  963.     emit_move_insn (gen_rtx (REG, SImode, regno + i),
  964.             gen_rtx (MEM, SImode,
  965.                  memory_address (SImode,
  966.                          plus_constant (XEXP (x, 0),
  967.                                 i * GET_MODE_SIZE (SImode)))));
  968.     }
  969. }
  970.  
  971. /* Copy all or part of a BLKmode value X out of registers starting at REGNO.
  972.    The number of registers to be filled is NREGS.  */
  973.  
  974. void
  975. move_block_from_reg (regno, x, nregs)
  976.      int regno;
  977.      rtx x;
  978.      int nregs;
  979. {
  980.   int i;
  981.   for (i = 0; i < nregs; i++)
  982.     {
  983.       if (GET_CODE (x) == REG)
  984.     emit_move_insn (gen_rtx (SUBREG, SImode, x, i),
  985.             gen_rtx (REG, SImode, regno + i));
  986.       else
  987.     emit_move_insn (gen_rtx (MEM, SImode,
  988.                  memory_address (SImode,
  989.                          plus_constant (XEXP (x, 0),
  990.                                 i * GET_MODE_SIZE (SImode)))),
  991.             gen_rtx (REG, SImode, regno + i));
  992.     }
  993. }
  994.  
  995. /* Mark NREGS consecutive regs, starting at REGNO, as being live now.  */
  996.  
  997. static void
  998. use_regs (regno, nregs)
  999.      int regno;
  1000.      int nregs;
  1001. {
  1002.   int i;
  1003.   for (i = 0; i < nregs; i++)
  1004.     emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, SImode, regno + i)));
  1005. }
  1006.  
  1007. /* Write zeros through the storage of OBJECT.
  1008.    If OBJECT has BLKmode, SIZE is its length in bytes.  */
  1009.  
  1010. void
  1011. clear_storage (object, size)
  1012.      rtx object;
  1013.      int size;
  1014. {
  1015.   if (GET_MODE (object) == BLKmode)
  1016.     {
  1017. #ifdef TARGET_MEM_FUNCTIONS
  1018.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memset"), 0,
  1019.              VOIDmode, 3,
  1020.              XEXP (object, 0), Pmode, const0_rtx, Pmode,
  1021.              gen_rtx (CONST_INT, VOIDmode, size), Pmode);
  1022. #else
  1023.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bzero"), 0,
  1024.              VOIDmode, 2,
  1025.              XEXP (object, 0), Pmode,
  1026.              gen_rtx (CONST_INT, VOIDmode, size), Pmode);
  1027. #endif
  1028.     }
  1029.   else
  1030.     emit_move_insn (object, const0_rtx);
  1031. }
  1032.  
  1033. /* Generate code to copy Y into X.
  1034.    Both Y and X must have the same mode, except that
  1035.    Y can be a constant with VOIDmode.
  1036.    This mode cannot be BLKmode; use emit_block_move for that.
  1037.  
  1038.    Return the last instruction emitted.  */
  1039.  
  1040. rtx
  1041. emit_move_insn (x, y)
  1042.      rtx x, y;
  1043. {
  1044.   enum machine_mode mode = GET_MODE (x);
  1045.   x = protect_from_queue (x, 1);
  1046.   y = protect_from_queue (y, 0);
  1047.  
  1048.   if ((CONSTANT_P (y) || GET_CODE (y) == CONST_DOUBLE)
  1049.       && ! LEGITIMATE_CONSTANT_P (y))
  1050.     {
  1051.       y = force_const_mem (mode, y);
  1052.       if (! memory_address_p (mode, XEXP (y, 0)))
  1053.     y = gen_rtx (MEM, mode, memory_address (mode, XEXP (y, 0)));
  1054.     }
  1055.  
  1056.   if (mode == BLKmode)
  1057.     abort ();
  1058.   if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  1059.     return
  1060.       emit_insn (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));
  1061. #if 0
  1062.   /* It turns out you get much better optimization (in cse and flow)
  1063.      if you define movdi and movdf instruction patterns
  1064.      even if they must turn into multiple assembler instructions.  */
  1065.   else if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (SImode))
  1066.     {
  1067.       register int count = GET_MODE_SIZE (mode) / GET_MODE_SIZE (SImode);
  1068.       register int i;
  1069.       if (GET_CODE (y) == CONST_DOUBLE && y != dconst0_rtx)
  1070.     y = force_const_double_mem (y);
  1071.       for (i = 0; i < count; i++)
  1072.     {
  1073.       rtx x1, y1;
  1074.       if (GET_CODE (x) == REG)
  1075.         x1 = gen_rtx (SUBREG, SImode, x, i);
  1076.       else
  1077.         x1 = gen_rtx (MEM, SImode,
  1078.               memory_address (SImode,
  1079.                       plus_constant (XEXP (x, 0),
  1080.                              i * GET_MODE_SIZE (SImode))));
  1081.       if (GET_CODE (y) == REG)
  1082.         y1 = gen_rtx (SUBREG, SImode, y, i);
  1083.       else if (y == dconst0_rtx)
  1084.         y1 = const0_rtx;
  1085.       else
  1086.         y1 = gen_rtx (MEM, SImode,
  1087.               memory_address (SImode,
  1088.                       plus_constant (XEXP (y, 0),
  1089.                              i * GET_MODE_SIZE (SImode))));
  1090.       emit_insn (gen_movsi (protect_from_queue (x1, 1), protect_from_queue (y1, 0)));
  1091.     }
  1092.     }
  1093. #endif
  1094.   else
  1095.     abort ();
  1096. }
  1097.  
  1098. /* Pushing data onto the stack.  */
  1099.  
  1100. /* Push a block of length SIZE (perhaps variable)
  1101.    and return an rtx to address the beginning of the block.
  1102.    Note that it is not possible for the value returned to be a QUEUED.
  1103.    The value may be stack_pointer_rtx.
  1104.  
  1105.    The value we return does take account of STACK_POINTER_OFFSET.  */
  1106.  
  1107. rtx
  1108. push_block (size)
  1109.      rtx size;
  1110. {
  1111.   register rtx temp;
  1112.   if (CONSTANT_P (size) || GET_CODE (size) == REG)
  1113.     anti_adjust_stack (size);
  1114.   else
  1115.     anti_adjust_stack (copy_to_mode_reg (Pmode, size));
  1116.  
  1117. #ifdef STACK_GROWS_DOWNWARD
  1118.   temp = stack_pointer_rtx;
  1119. #else
  1120.   temp = gen_rtx (PLUS, Pmode,
  1121.           stack_pointer_rtx,
  1122.           negate_rtx (Pmode, size));
  1123.   if (GET_CODE (size) != CONST_INT)
  1124.     temp = force_operand (temp, 0);
  1125. #endif
  1126.  
  1127. #ifdef STACK_POINTER_OFFSET
  1128.   temp = plus_constant (temp, STACK_POINTER_OFFSET);
  1129. #endif /* STACK_POINTER_OFFSET */
  1130.  
  1131.   return memory_address (QImode, temp);
  1132. }
  1133.  
  1134. static rtx
  1135. gen_push_operand ()
  1136. {
  1137.   return gen_rtx (
  1138. #ifdef STACK_GROWS_DOWNWARD
  1139.           PRE_DEC,
  1140. #else
  1141.           PRE_INC,
  1142. #endif
  1143.           Pmode,
  1144.           stack_pointer_rtx);
  1145. }
  1146.  
  1147. /* Generate code to push X onto the stack, assuming it has mode MODE.
  1148.    MODE is redundant except when X is a CONST_INT (since they don't
  1149.    carry mode info).
  1150.    SIZE is an rtx for the size of data to be copied (in bytes),
  1151.    needed only if X is BLKmode.
  1152.  
  1153.    ALIGN (in bytes) is maximum alignment we can assume.
  1154.  
  1155.    If PARTIAL is nonzero, then copy that many of the first words
  1156.    of X into registers starting with REG, and push the rest of X.
  1157.    The amount of space pushed is decreased by PARTIAL words,
  1158.    rounded *down* to a multiple of PARM_BOUNDARY.
  1159.    REG must be a hard register in this case.
  1160.  
  1161.    EXTRA is the amount in bytes of extra space to leave next to this arg.
  1162.  
  1163.    On a machine that lacks real push insns, ARGS_ADDR is the address of
  1164.    the bottom of the argument block for this call.  We use indexing off there
  1165.    to store the arg.  On machines with push insns, ARGS_ADDR is 0.
  1166.  
  1167.    ARGS_SO_FAR is the size of args previously pushed for this call.  */
  1168.  
  1169. static void
  1170. emit_push_insn (x, mode, size, align, partial, reg, extra, args_addr, args_so_far)
  1171.      register rtx x;
  1172.      enum machine_mode mode;
  1173.      rtx size;
  1174.      int align;
  1175.      int partial;
  1176.      rtx reg;
  1177.      int extra;
  1178.      rtx args_addr;
  1179.      rtx args_so_far;
  1180. {
  1181.   rtx xinner;
  1182.   enum direction stack_direction
  1183. #ifdef STACK_GROWS_DOWNWARD
  1184.     = downward;
  1185. #else
  1186.     = upward;
  1187. #endif
  1188.  
  1189.   /* Decide where to pad the argument: `downward' for below,
  1190.      `upward' for above, or `none' for don't pad it.
  1191.      Default is below for small data on big-endian machines; else above.  */
  1192.   enum direction where_pad = FUNCTION_ARG_PADDING (mode, size);
  1193.  
  1194.   xinner = x = protect_from_queue (x, 0);
  1195.  
  1196.   if (extra)
  1197.     {
  1198.       if (args_addr == 0)
  1199.     {
  1200.       /* Push padding now if padding above and stack grows down,
  1201.          or if padding below and stack grows up.  */
  1202.       if (where_pad != none && where_pad != stack_direction)
  1203.         anti_adjust_stack (gen_rtx (CONST_INT, VOIDmode, extra));
  1204.     }
  1205.       else
  1206.     {
  1207.       /* If space already allocated, just adjust the address we use.  */
  1208.       if (where_pad == downward)
  1209.         args_so_far = plus_constant (args_so_far, extra);
  1210.     }
  1211.     }
  1212.  
  1213.   if (mode == BLKmode)
  1214.     {
  1215.       /* Copy a block into the stack, entirely or partially.  */
  1216.  
  1217.       register rtx temp;
  1218.       int used = partial * UNITS_PER_WORD;
  1219.       int offset = used % (PARM_BOUNDARY / BITS_PER_UNIT);
  1220.       int skip;
  1221.       
  1222.       if (size == 0)
  1223.     abort ();
  1224.  
  1225.       used -= offset;
  1226.  
  1227.       /* USED is now the # of bytes we need not copy to the stack
  1228.      because registers will take care of them.  */
  1229.  
  1230.       if (partial != 0)
  1231.     xinner = change_address (xinner, BLKmode,
  1232.                  plus_constant (XEXP (xinner, 0), used));
  1233.  
  1234. /* If the partial register-part of the arg counts in its stack size,
  1235.    skip the part of stack space corresponding to the registers.
  1236.    Otherwise, start copying to the beginning of the stack space,
  1237.    by setting SKIP to 0.  */
  1238. #ifndef FIRST_PARM_CALLER_OFFSET
  1239.       skip = 0;
  1240. #else
  1241.       skip = used;
  1242. #endif
  1243.  
  1244. #ifdef PUSH_ROUNDING
  1245.       /* Do it with several push insns if that doesn't take lots of insns
  1246.      and if there is no difficulty with push insns that skip bytes
  1247.      on the stack for alignment purposes.  */
  1248.       if (args_addr == 0
  1249.       && GET_CODE (size) == CONST_INT
  1250.       && args_addr == 0
  1251.       && skip == 0
  1252.       && (move_by_pieces_ninsns ((unsigned) INTVAL (size) - used, align)
  1253.           < MOVE_RATIO)
  1254.       && PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
  1255.     move_by_pieces (gen_rtx (MEM, BLKmode, gen_push_operand ()), xinner,
  1256.             INTVAL (size) - used, align);
  1257.       else
  1258. #endif /* PUSH_ROUNDING */
  1259.     {
  1260.       /* Otherwise make space on the stack and copy the data
  1261.          to the address of that space.  */
  1262.  
  1263.       /* Deduct words put into registers from the size we must copy.  */
  1264.       if (partial != 0)
  1265.         {
  1266.           if (GET_CODE (size) == CONST_INT)
  1267.         size = gen_rtx (CONST_INT, VOIDmode, INTVAL (size) - used);
  1268.           else
  1269.         size = expand_binop (GET_MODE (size), sub_optab, size,
  1270.                      gen_rtx (CONST_INT, VOIDmode, used),
  1271.                      0, 0, OPTAB_LIB_WIDEN);
  1272.         }
  1273.  
  1274.       /* Get the address of the stack space.  */
  1275.       if (! args_addr)
  1276.         temp = push_block (size);
  1277.       else if (GET_CODE (args_so_far) == CONST_INT)
  1278.         temp = memory_address (BLKmode,
  1279.                    plus_constant (args_addr,
  1280.                           skip + INTVAL (args_so_far)));
  1281.       else
  1282.         temp = memory_address (BLKmode,
  1283.                    plus_constant (gen_rtx (PLUS, Pmode,
  1284.                                args_addr, args_so_far),
  1285.                           skip));
  1286.  
  1287.       /* TEMP is the address of the block.  Copy the data there.  */
  1288.       if (GET_CODE (size) == CONST_INT
  1289.           && (move_by_pieces_ninsns ((unsigned) INTVAL (size), align)
  1290.           < MOVE_RATIO))
  1291.         {
  1292.           move_by_pieces (gen_rtx (MEM, BLKmode, temp), xinner,
  1293.                   INTVAL (size), align);
  1294.           goto ret;
  1295.         }
  1296.       /* Try the most limited insn first, because there's no point
  1297.          including more than one in the machine description unless
  1298.          the more limited one has some advantage.  */
  1299. #ifdef HAVE_movstrqi
  1300.       if (HAVE_movstrqi
  1301.           && GET_CODE (size) == CONST_INT
  1302.           && ((unsigned) INTVAL (size)
  1303.           < (1 << (GET_MODE_BITSIZE (QImode) - 1))))
  1304.         {
  1305.           emit_insn (gen_movstrqi (gen_rtx (MEM, BLKmode, temp),
  1306.                        xinner, size,
  1307.                        gen_rtx (CONST_INT, VOIDmode, align)));
  1308.           goto ret;
  1309.         }
  1310. #endif
  1311. #ifdef HAVE_movstrhi
  1312.       if (HAVE_movstrhi
  1313.           && GET_CODE (size) == CONST_INT
  1314.           && ((unsigned) INTVAL (size)
  1315.           < (1 << (GET_MODE_BITSIZE (HImode) - 1))))
  1316.         {
  1317.           emit_insn (gen_movstrhi (gen_rtx (MEM, BLKmode, temp),
  1318.                        xinner, size,
  1319.                        gen_rtx (CONST_INT, VOIDmode, align)));
  1320.           goto ret;
  1321.         }
  1322. #endif
  1323. #ifdef HAVE_movstrsi
  1324.       if (HAVE_movstrsi)
  1325.         {
  1326.           emit_insn (gen_movstrsi (gen_rtx (MEM, BLKmode, temp),
  1327.                        xinner, size,
  1328.                        gen_rtx (CONST_INT, VOIDmode, align)));
  1329.           goto ret;
  1330.         }
  1331. #endif
  1332.  
  1333.       if (reg_mentioned_p (stack_pointer_rtx, temp))
  1334.         {
  1335.           /* Now that emit_library_call does force_operand
  1336.          before pushing anything, preadjustment does not work.  */
  1337.           temp = copy_to_reg (temp);
  1338. #if 0
  1339.           /* Correct TEMP so it holds what will be a description of
  1340.          the address to copy to, valid after one arg is pushed.  */
  1341.           int xsize = GET_MODE_SIZE (Pmode);
  1342. #ifdef PUSH_ROUNDING
  1343.           xsize = PUSH_ROUNDING (xsize);
  1344. #endif
  1345.           xsize = ((xsize + PARM_BOUNDARY / BITS_PER_UNIT - 1)
  1346.                / (PARM_BOUNDARY / BITS_PER_UNIT)
  1347.                * (PARM_BOUNDARY / BITS_PER_UNIT));
  1348. #ifdef TARGET_MEM_FUNCTIONS
  1349.           /* If we are calling bcopy, we push one arg before TEMP.
  1350.          If calling memcpy, we push two.  */
  1351.           xsize *= 2;
  1352. #endif
  1353. #ifdef STACK_GROWS_DOWNWARD
  1354.           temp = plus_constant (temp, xsize);
  1355. #else
  1356.           temp = plus_constant (temp, -xsize);
  1357. #endif /* not STACK_GROWS_DOWNWARD */
  1358. #endif /* 0 */
  1359.         }
  1360.  
  1361.       /* Make inhibit_defer_pop nonzero around the library call
  1362.          to force it to pop the bcopy-arguments right away.  */
  1363.       NO_DEFER_POP;
  1364. #ifdef TARGET_MEM_FUNCTIONS
  1365.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"), 0,
  1366.                  VOIDmode, 3, temp, Pmode, XEXP (xinner, 0), Pmode,
  1367.                  size, Pmode);
  1368. #else
  1369.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcopy"), 0,
  1370.                  VOIDmode, 3, XEXP (xinner, 0), Pmode, temp, Pmode,
  1371.                  size, Pmode);
  1372. #endif
  1373.       OK_DEFER_POP;
  1374.     }
  1375.     }
  1376.   else if (partial > 0)
  1377.     {
  1378.       /* Scalar partly in registers.  */
  1379.  
  1380.       int size = GET_MODE_SIZE (mode) / UNITS_PER_WORD;
  1381.       int i;
  1382.       int not_stack;
  1383.       /* # words of start of argument
  1384.      that we must make space for but need not store.  */
  1385.       int offset = partial % (PARM_BOUNDARY / BITS_PER_WORD);
  1386.       int args_offset = INTVAL (args_so_far);
  1387.       int skip;
  1388.  
  1389.       /* If we make space by pushing it, we might as well push
  1390.      the real data.  Otherwise, we can leave OFFSET nonzero
  1391.      and leave the space uninitialized.  */
  1392.       if (args_addr == 0)
  1393.     offset = 0;
  1394.  
  1395.       /* Now NOT_STACK gets the number of words that we don't need to
  1396.      allocate on the stack.  */
  1397.       not_stack = partial - offset;
  1398.  
  1399. /* If the partial register-part of the arg counts in its stack size,
  1400.    skip the part of stack space corresponding to the registers.
  1401.    Otherwise, start copying to the beginning of the stack space,
  1402.    by setting SKIP to 0.  */
  1403. #ifndef FIRST_PARM_CALLER_OFFSET
  1404.       skip = 0;
  1405. #else
  1406.       skip = not_stack;
  1407. #endif
  1408.  
  1409.       if (GET_CODE (x) == CONST_DOUBLE && x != dconst0_rtx)
  1410.     x = force_const_double_mem (x);
  1411.  
  1412.       /* Loop over all the words allocated on the stack for this arg.  */
  1413.       /* We can do it by words, because any scalar bigger than a word
  1414.      has a size a multiple of a word.  */
  1415. #ifndef PUSH_ARGS_REVERSED
  1416.       for (i = not_stack; i < size; i++)
  1417. #else
  1418.       for (i = size - 1; i >= not_stack; i--)
  1419. #endif
  1420.     if (i >= not_stack + offset)
  1421.       {
  1422.         rtx wd;
  1423.         rtx addr;
  1424.         /* Get the next word of the value in WD.  */
  1425.         if (GET_CODE (x) == MEM)
  1426.           {
  1427.         rtx addr = memory_address (SImode,
  1428.                        plus_constant (XEXP (x, 0),
  1429.                               i * UNITS_PER_WORD));
  1430.         /* Copy to a reg, since machine may lack
  1431.            memory-to-memory move insns.  */
  1432.         wd = copy_to_reg (gen_rtx (MEM, SImode, addr));
  1433.           }
  1434.         else if (GET_CODE (x) == REG)
  1435.           wd = gen_rtx (SUBREG, SImode, x, i);
  1436.         else if (x == dconst0_rtx)
  1437.           wd = const0_rtx;
  1438.         else
  1439.           abort ();
  1440.  
  1441.         emit_push_insn (wd,
  1442.                 SImode, 0, align, 0, 0, 0, args_addr,
  1443.                 gen_rtx (CONST_INT, VOIDmode,
  1444.                      args_offset + (i - not_stack + skip) * UNITS_PER_WORD));
  1445.       }
  1446.     }
  1447.   else
  1448.     {
  1449.       rtx addr;
  1450. #ifdef PUSH_ROUNDING
  1451.       if (args_addr == 0)
  1452.     addr = gen_push_operand ();
  1453.       else
  1454. #endif
  1455.     if (GET_CODE (args_so_far) == CONST_INT)
  1456.       addr
  1457.         = memory_address (mode,
  1458.                   plus_constant (args_addr, INTVAL (args_so_far)));
  1459.       else
  1460.     addr = memory_address (mode, gen_rtx (PLUS, Pmode, args_addr,
  1461.                           args_so_far));
  1462.  
  1463.       emit_move_insn (gen_rtx (MEM, mode, addr), x);
  1464.     }
  1465.  
  1466.  ret:
  1467.   /* If part should go in registers, copy that part
  1468.      into the appropriate registers.  Do this now, at the end,
  1469.      since mem-to-mem copies above may do function calls.  */
  1470.   if (partial > 0)
  1471.     move_block_to_reg (REGNO (reg), x, partial);
  1472.  
  1473.   if (extra && args_addr == 0 && where_pad == stack_direction)
  1474.     anti_adjust_stack (gen_rtx (CONST_INT, VOIDmode, extra));
  1475. }
  1476.  
  1477. /* Output a library call to function FUN (a SYMBOL_REF rtx)
  1478.    (emitting the queue unless NO_QUEUE is nonzero),
  1479.    for a value of mode OUTMODE,
  1480.    with NARGS different arguments, passed as alternating rtx values
  1481.    and machine_modes to convert them to.
  1482.    The rtx values should have been passed through protect_from_queue already.  */
  1483.  
  1484. void
  1485. emit_library_call (va_alist)
  1486.      va_dcl
  1487. {
  1488.   register va_list p;
  1489.   register int args_size = 0;
  1490.   register int argnum;
  1491.   enum machine_mode outmode;
  1492.   int nargs;
  1493.   rtx fun;
  1494.   rtx orgfun;
  1495.   int inc;
  1496.   int count;
  1497.   rtx *regvec;
  1498.   rtx argblock = 0;
  1499.   CUMULATIVE_ARGS args_so_far;
  1500.   struct arg { rtx value; enum machine_mode mode; };
  1501.   struct arg *argvec;
  1502.   int old_inhibit_defer_pop = inhibit_defer_pop;
  1503.   int stack_padding = 0;
  1504.   int no_queue = 0;
  1505.   rtx use_insns;
  1506.  
  1507.   va_start (p);
  1508.   orgfun = fun = va_arg (p, rtx);
  1509.   no_queue = va_arg (p, int);
  1510.   outmode = va_arg (p, enum machine_mode);
  1511.   nargs = va_arg (p, int);
  1512.  
  1513.   regvec = (rtx *) alloca (nargs * sizeof (rtx));
  1514.  
  1515.   /* Copy all the libcall-arguments out of the varargs data
  1516.      and into a vector ARGVEC.  */
  1517.   argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
  1518.   for (count = 0; count < nargs; count++)
  1519.     {
  1520.       rtx val = va_arg (p, rtx);
  1521.       enum machine_mode mode = va_arg (p, enum machine_mode);
  1522.  
  1523.       argvec[count].value = val;
  1524.  
  1525.       /* Convert the arg value to the mode the library wants.
  1526.      Also make sure it is a reasonable operand
  1527.      for a move or push insn.  */
  1528.       /* ??? It is wrong to do it here; must do it earlier
  1529.      where we know the signedness of the arg.  */
  1530.       if (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode)
  1531.     {
  1532.       val = gen_reg_rtx (mode);
  1533.       convert_move (val, argvec[count].value, 0);
  1534.     }
  1535.       else if (GET_CODE (val) != REG && GET_CODE (val) != MEM
  1536.            
  1537.            && ! ((CONSTANT_P (val) || GET_CODE (val) == CONST_DOUBLE)
  1538.              && LEGITIMATE_CONSTANT_P (val)))
  1539.     val = force_operand (val, 0);
  1540.  
  1541.       argvec[count].value = val;
  1542.       argvec[count].mode = mode;
  1543.     }
  1544.   va_end (p);
  1545.  
  1546.   /* If we have no actual push instructions, make space for all the args
  1547.      right now.  */
  1548. #ifndef PUSH_ROUNDING
  1549.   INIT_CUMULATIVE_ARGS (args_so_far, (tree)0);
  1550.   for (count = 0; count < nargs; count++)
  1551.     {
  1552.       register enum machine_mode mode = argvec[count].mode;
  1553.       register rtx reg;
  1554.       register int partial;
  1555.  
  1556.       reg = FUNCTION_ARG (args_so_far, mode, (tree)0, 1);
  1557. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  1558.       partial = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, (tree)0, 1);
  1559. #else
  1560.       partial = 0;
  1561. #endif
  1562.       if (reg == 0 || partial != 0)
  1563.     args_size += GET_MODE_SIZE (mode);
  1564.       if (partial != 0)
  1565.     args_size -= partial * GET_MODE_SIZE (SImode);
  1566.       FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree)0, 1);
  1567.     }
  1568.  
  1569.   if (args_size != 0)
  1570.     {
  1571. #ifdef STACK_ARGS_ADJUST
  1572.       struct args_size size;
  1573.       size.constant = args_size;
  1574.       size.var = 0;
  1575.       STACK_ARGS_ADJUST (size);
  1576.       args_size = size.constant;
  1577. #endif
  1578.       argblock
  1579.     = push_block (round_push (gen_rtx (CONST_INT, VOIDmode, args_size)));
  1580.     }
  1581. #endif /* no PUSH_ROUNDING */
  1582.  
  1583.   INIT_CUMULATIVE_ARGS (args_so_far, (tree)0);
  1584.  
  1585. #ifdef PUSH_ARGS_REVERSED
  1586.   inc = -1;
  1587.   argnum = nargs - 1;
  1588. #else
  1589.   inc = 1;
  1590.   argnum = 0;
  1591. #endif
  1592.   args_size = stack_padding;
  1593.  
  1594.   for (count = 0; count < nargs; count++, argnum += inc)
  1595.     {
  1596.       register enum machine_mode mode = argvec[argnum].mode;
  1597.       register rtx val = argvec[argnum].value;
  1598.       rtx reg;
  1599.       int partial;
  1600.       int arg_size;
  1601.  
  1602.       reg = FUNCTION_ARG (args_so_far, mode, (tree)0, 1);
  1603.       regvec[argnum] = reg;
  1604. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  1605.       partial = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, (tree)0, 1);
  1606. #else
  1607.       partial = 0;
  1608. #endif
  1609.  
  1610.       if (reg != 0 && partial == 0)
  1611.     emit_move_insn (reg, val);
  1612.       else
  1613.     emit_push_insn (val, mode, 0, 0, partial, reg, 0, argblock,
  1614.             gen_rtx (CONST_INT, VOIDmode, args_size));
  1615.  
  1616.       /* Compute size of stack space used by this argument.  */
  1617.       if (reg == 0 || partial != 0)
  1618.     arg_size = GET_MODE_SIZE (mode);
  1619.       else
  1620.     arg_size = 0;
  1621.       if (partial != 0)
  1622.     arg_size
  1623.       -= ((partial * UNITS_PER_WORD)
  1624.           / (PARM_BOUNDARY / BITS_PER_UNIT)
  1625.           * (PARM_BOUNDARY / BITS_PER_UNIT));
  1626.  
  1627.       args_size += arg_size;
  1628.       NO_DEFER_POP;
  1629.       FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree)0, 1);
  1630.     }
  1631.  
  1632.   /* For version 1.37, try deleting this entirely.  */
  1633.   if (! no_queue)
  1634.     emit_queue ();
  1635.  
  1636.   fun = prepare_call_address (fun, 0);
  1637.  
  1638.   /* Any regs containing parms remain in use through the call.  */
  1639.   start_sequence ();
  1640.   for (count = 0; count < nargs; count++)
  1641.     if (regvec[count] != 0)
  1642.       emit_insn (gen_rtx (USE, VOIDmode, regvec[count]));
  1643.  
  1644.   use_insns = gen_sequence ();
  1645.   end_sequence ();
  1646.  
  1647. #ifdef STACK_BOUNDARY
  1648.   args_size = (args_size + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES;
  1649. #endif
  1650.  
  1651.   /* Don't allow popping to be deferred, since then
  1652.      cse'ing of library calls could delete a call and leave the pop.  */
  1653.   NO_DEFER_POP;
  1654.   emit_call_1 (fun, get_identifier (XSTR (orgfun, 0)), args_size,
  1655.            FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
  1656.            outmode != VOIDmode ? hard_libcall_value (outmode) : 0,
  1657.            old_inhibit_defer_pop + 1, use_insns);
  1658.   OK_DEFER_POP;
  1659. }
  1660.  
  1661. /* Expand an assignment that stores the value of FROM into TO.
  1662.    If WANT_VALUE is nonzero, return an rtx for the value of TO.
  1663.    (This may contain a QUEUED rtx.)
  1664.    Otherwise, the returned value is not meaningful.
  1665.  
  1666.    SUGGEST_REG is no longer actually used.
  1667.    It used to mean, copy the value through a register
  1668.    and return that register, if that is possible.
  1669.    But now we do this if WANT_VALUE.
  1670.  
  1671.    If the value stored is a constant, we return the constant.  */
  1672.  
  1673. rtx
  1674. expand_assignment (to, from, want_value, suggest_reg)
  1675.      tree to, from;
  1676.      int want_value;
  1677.      int suggest_reg;
  1678. {
  1679.   register rtx to_rtx = 0;
  1680.  
  1681.   /* Don't crash if the lhs of the assignment was erroneous.  */
  1682.  
  1683.   if (TREE_CODE (to) == ERROR_MARK)
  1684.     return expand_expr (from, 0, VOIDmode, 0);
  1685.  
  1686.   /* Assignment of a structure component needs special treatment
  1687.      if the structure component's rtx is not simply a MEM.
  1688.      Assignment of an array element at a constant index
  1689.      has the same problem.  */
  1690.  
  1691.   if (TREE_CODE (to) == COMPONENT_REF
  1692.       || (TREE_CODE (to) == ARRAY_REF
  1693.       && TREE_CODE (TREE_OPERAND (to, 1)) == INTEGER_CST
  1694.       && TREE_CODE (TYPE_SIZE (TREE_TYPE (to))) == INTEGER_CST))
  1695.     {
  1696.       register enum machine_mode mode1;
  1697.       int bitsize;
  1698.       int volstruct = 0;
  1699.       tree tem = to;
  1700.       int bitpos = 0;
  1701.       int unsignedp;
  1702.  
  1703.       if (TREE_CODE (to) == COMPONENT_REF)
  1704.     {
  1705.       tree field = TREE_OPERAND (to, 1);
  1706.       bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) * DECL_SIZE_UNIT (field);
  1707.       mode1 = DECL_MODE (TREE_OPERAND (to, 1));
  1708.       unsignedp = TREE_UNSIGNED (field);
  1709.     }
  1710.       else
  1711.     {
  1712.       mode1 = TYPE_MODE (TREE_TYPE (to));
  1713.       bitsize = GET_MODE_BITSIZE (mode1);
  1714.       unsignedp = TREE_UNSIGNED (TREE_TYPE (to));
  1715.     }
  1716.  
  1717.       /* Compute cumulative bit-offset for nested component-refs
  1718.      and array-refs, and find the ultimate containing object.  */
  1719.  
  1720.       while (1)
  1721.     {
  1722.       if (TREE_CODE (tem) == COMPONENT_REF)
  1723.         {
  1724.           bitpos += DECL_OFFSET (TREE_OPERAND (tem, 1));
  1725.           if (TREE_THIS_VOLATILE (tem))
  1726.         volstruct = 1;
  1727.         }
  1728.       else if (TREE_CODE (tem) == ARRAY_REF
  1729.            && TREE_CODE (TREE_OPERAND (tem, 1)) == INTEGER_CST
  1730.            && TREE_CODE (TYPE_SIZE (TREE_TYPE (tem))) == INTEGER_CST)
  1731.         {
  1732.           bitpos += (TREE_INT_CST_LOW (TREE_OPERAND (tem, 1))
  1733.              * TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)))
  1734.              * TYPE_SIZE_UNIT (TREE_TYPE (tem)));
  1735.         }
  1736.       else
  1737.         break;
  1738.       tem = TREE_OPERAND (tem, 0);
  1739.     }
  1740.       /* TEM is now the containing data object.  */
  1741.  
  1742.       /* If we are going to use store_bit_field and extract_bit_field,
  1743.      make sure to_rtx will be safe for multiple use.  */
  1744.       if (mode1 == BImode && want_value)
  1745.     tem = stabilize_reference (tem);
  1746.  
  1747.       to_rtx = expand_expr (tem, 0, VOIDmode, 0);
  1748.  
  1749.       return store_field (to_rtx, bitsize, bitpos, mode1, from,
  1750.               (want_value
  1751.                /* Spurious cast makes HPUX compiler happy.  */
  1752.                ? (enum machine_mode) TYPE_MODE (TREE_TYPE (to))
  1753.                : VOIDmode),
  1754.               unsignedp,
  1755.               /* Required alignment of containing datum.  */
  1756.               TYPE_ALIGN (TREE_TYPE (tem)) / BITS_PER_UNIT);
  1757.     }
  1758.  
  1759.   /* Ordinary treatment.  Expand TO to get a REG or MEM rtx.
  1760.      Don't re-expand if it was expanded already (in COMPONENT_REF case).  */
  1761.  
  1762.   if (to_rtx == 0)
  1763.     to_rtx = expand_expr (to, 0, VOIDmode, 0);
  1764.  
  1765.   /* Compute FROM and store the value in the rtx we got.  */
  1766.  
  1767.   return store_expr (from, to_rtx, want_value);
  1768. }
  1769.  
  1770. /* Generate code for computing expression EXP,
  1771.    and storing the value into TARGET.
  1772.    Returns TARGET or an equivalent value.
  1773.    TARGET may contain a QUEUED rtx.
  1774.  
  1775.    If SUGGEST_REG is nonzero, copy the value through a register
  1776.    and return that register, if that is possible.
  1777.  
  1778.    If the value stored is a constant, we return the constant.  */
  1779.  
  1780. rtx
  1781. store_expr (exp, target, suggest_reg)
  1782.      register tree exp;
  1783.      register rtx target;
  1784.      int suggest_reg;
  1785. {
  1786.   register rtx temp;
  1787.   int dont_return_target = 0;
  1788.  
  1789.   /* Copying a non-constant CONSTRUCTOR needs special treatment.  */
  1790.  
  1791.   if (TREE_CODE (exp) == CONSTRUCTOR && ! TREE_LITERAL (exp))
  1792.     {
  1793.       store_constructor (exp, target);
  1794.       return target;
  1795.     }
  1796.  
  1797.   if (suggest_reg && GET_CODE (target) == MEM && GET_MODE (target) != BLKmode)
  1798.     /* If target is in memory and caller wants value in a register instead,
  1799.        arrange that.  Pass TARGET as target for expand_expr so that,
  1800.        if EXP is another assignment, SUGGEST_REG will be nonzero for it.
  1801.        We know expand_expr will not use the target in that case.  */
  1802.     {
  1803.       temp = expand_expr (exp, cse_not_expected ? 0 : target,
  1804.               GET_MODE (target), 0);
  1805.       if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
  1806.     temp = copy_to_reg (temp);
  1807.       dont_return_target = 1;
  1808.     }
  1809.   else if (queued_subexp_p (target))
  1810.     /* If target contains a postincrement, it is not safe
  1811.        to use as the returned value.  It would access the wrong
  1812.        place by the time the queued increment gets output.
  1813.        So copy the value through a temporary and use that temp
  1814.        as the result.  */
  1815.     {
  1816.       temp = expand_expr (exp, 0, GET_MODE (target), 0);
  1817.       if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
  1818.     temp = copy_to_reg (temp);
  1819.       dont_return_target = 1;
  1820.     }
  1821.   else
  1822.     {
  1823.       temp = expand_expr (exp, target, GET_MODE (target), 0);
  1824.       /* DO return TARGET if it's a specified hardware register.
  1825.      expand_return relies on this.  */
  1826.       if (!(target && GET_CODE (target) == REG
  1827.         && REGNO (target) < FIRST_PSEUDO_REGISTER)
  1828.       && (CONSTANT_P (temp) || GET_CODE (temp) == CONST_DOUBLE))
  1829.     dont_return_target = 1;
  1830.     }
  1831.  
  1832.   /* If value was not generated in the target, store it there.
  1833.      Convert the value to TARGET's type first if nec.  */
  1834.  
  1835.   if (temp != target && TREE_CODE (exp) != ERROR_MARK)
  1836.     {
  1837.       target = protect_from_queue (target, 1);
  1838.       if (GET_MODE (temp) != GET_MODE (target)
  1839.       && GET_MODE (temp) != VOIDmode)
  1840.     {
  1841.       int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  1842.       if (dont_return_target)
  1843.         {
  1844.           /* In this case, we will return TEMP,
  1845.          so make sure it has the proper mode.
  1846.          But don't forget to store the value into TARGET.  */
  1847.           temp = convert_to_mode (GET_MODE (target), temp, unsignedp);
  1848.           emit_move_insn (target, temp);
  1849.         }
  1850.       else
  1851.         convert_move (target, temp, unsignedp);
  1852.     }
  1853.  
  1854.       else if (GET_MODE (temp) == BLKmode)
  1855.     emit_block_move (target, temp, expr_size (exp),
  1856.              TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  1857.       else
  1858.     emit_move_insn (target, temp);
  1859.     }
  1860.   if (dont_return_target)
  1861.     return temp;
  1862.   return target;
  1863. }
  1864.  
  1865. /* Store the value of constructor EXP into the rtx TARGET.
  1866.    TARGET is either a REG or a MEM.  */
  1867.  
  1868. static void
  1869. store_constructor (exp, target)
  1870.      tree exp;
  1871.      rtx target;
  1872. {
  1873.   /* Don't try copying piece by piece into a hard register
  1874.      since that is vulnerable to being clobbered by EXP.
  1875.      Instead, construct in a pseudo register and then copy it all.  */
  1876.   if (GET_CODE (target) == REG && REGNO (target) < FIRST_PSEUDO_REGISTER)
  1877.     {
  1878.       rtx temp = gen_reg_rtx (GET_MODE (target));
  1879.       store_constructor (exp, temp);
  1880.       emit_move_insn (target, temp);
  1881.       return;
  1882.     }
  1883.  
  1884.   if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
  1885.     {
  1886.       register tree elt;
  1887.  
  1888.       /* If the constructor has fewer fields than the structure,
  1889.      clear the whole structure first.  */
  1890.  
  1891.       if (list_length (CONSTRUCTOR_ELTS (exp))
  1892.       != list_length (TYPE_FIELDS (TREE_TYPE (exp))))
  1893.     clear_storage (target, int_size_in_bytes (TREE_TYPE (exp)));
  1894.       else
  1895.     /* Inform later passes that the old value is dead.  */
  1896.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  1897.  
  1898.       /* Store each element of the constructor into
  1899.      the corresponding field of TARGET.  */
  1900.  
  1901.       for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
  1902.     {
  1903.       register tree field = TREE_PURPOSE (elt);
  1904.       register enum machine_mode mode;
  1905.       int bitsize;
  1906.       int bitpos;
  1907.       int unsignedp;
  1908.  
  1909.       bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) * DECL_SIZE_UNIT (field);
  1910.       mode = DECL_MODE (field);
  1911.       unsignedp = TREE_UNSIGNED (field);
  1912.  
  1913.       bitpos = DECL_OFFSET (field);
  1914.  
  1915.       store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
  1916.                /* The alignment of TARGET is
  1917.               at least what its type requires.  */
  1918.                VOIDmode, 0,
  1919.                TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  1920.     }
  1921.     }
  1922.   else if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
  1923.     {
  1924.       register tree elt;
  1925.       register int i;
  1926.       tree domain = TYPE_DOMAIN (TREE_TYPE (exp));
  1927.       int minelt = TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain));
  1928.       int maxelt = TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain));
  1929.       tree elttype = TREE_TYPE (TREE_TYPE (exp));
  1930.  
  1931.       /* If the constructor has fewer fields than the structure,
  1932.      clear the whole structure first.  */
  1933.  
  1934.       if (list_length (CONSTRUCTOR_ELTS (exp)) < maxelt - minelt + 1)
  1935.     clear_storage (target, maxelt - minelt + 1);
  1936.       else
  1937.     /* Inform later passes that the old value is dead.  */
  1938.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  1939.  
  1940.       /* Store each element of the constructor into
  1941.      the corresponding element of TARGET, determined
  1942.      by counting the elements.  */
  1943.       for (elt = CONSTRUCTOR_ELTS (exp), i = 0;
  1944.        elt;
  1945.        elt = TREE_CHAIN (elt), i++)
  1946.     {
  1947.       register enum machine_mode mode;
  1948.       int bitsize;
  1949.       int bitpos;
  1950.       int unsignedp;
  1951.  
  1952.       mode = TYPE_MODE (elttype);
  1953.       bitsize = GET_MODE_BITSIZE (mode);
  1954.       unsignedp = TREE_UNSIGNED (elttype);
  1955.  
  1956.       bitpos = (i * TREE_INT_CST_LOW (TYPE_SIZE (elttype))
  1957.             * TYPE_SIZE_UNIT (elttype));
  1958.  
  1959.       store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
  1960.                /* The alignment of TARGET is
  1961.               at least what its type requires.  */
  1962.                VOIDmode, 0,
  1963.                TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  1964.     }
  1965.     }
  1966. }
  1967.  
  1968. /* Store the value of EXP (an expression tree)
  1969.    into a subfield of TARGET which has mode MODE and occupies
  1970.    BITSIZE bits, starting BITPOS bits from the start of TARGET.
  1971.  
  1972.    If VALUE_MODE is VOIDmode, return nothing in particular.
  1973.    UNSIGNEDP is not used in this case.
  1974.  
  1975.    Otherwise, return an rtx for the value stored.  This rtx
  1976.    has mode VALUE_MODE if that is convenient to do.
  1977.    In this case, UNSIGNEDP must be nonzero if the value is an unsigned type.
  1978.  
  1979.    ALIGN is the alignment that TARGET is known to have, measured in bytes.  */
  1980.  
  1981. static rtx
  1982. store_field (target, bitsize, bitpos, mode, exp, value_mode, unsignedp, align)
  1983.      rtx target;
  1984.      int bitsize, bitpos;
  1985.      enum machine_mode mode;
  1986.      tree exp;
  1987.      enum machine_mode value_mode;
  1988.      int unsignedp;
  1989.      int align;
  1990. {
  1991.   /* If the structure is in a register or if the component
  1992.      is a bit field, we cannot use addressing to access it.
  1993.      Use bit-field techniques or SUBREG to store in it.  */
  1994.  
  1995.   if (mode == BImode || GET_CODE (target) == REG
  1996.       || GET_CODE (target) == SUBREG)
  1997.     {
  1998.       store_bit_field (target, bitsize, bitpos,
  1999.                mode,
  2000.                expand_expr (exp, 0, VOIDmode, 0),
  2001.                align);
  2002.       if (value_mode != VOIDmode)
  2003.     return extract_bit_field (target, bitsize, bitpos, unsignedp,
  2004.                   0, value_mode, 0, align);
  2005.       return const0_rtx;
  2006.     }
  2007.   else
  2008.     {
  2009.       rtx addr = XEXP (target, 0);
  2010.       rtx to_rtx;
  2011.  
  2012.       /* If a value is wanted, it must be the lhs;
  2013.      so make the address stable for multiple use.  */
  2014.  
  2015.       if (value_mode != VOIDmode && GET_CODE (addr) != REG
  2016.       && ! CONSTANT_ADDRESS_P (addr))
  2017.     addr = copy_to_reg (addr);
  2018.  
  2019.       /* Now build a reference to just the desired component.  */
  2020.  
  2021.       to_rtx = change_address (target, mode,
  2022.                    plus_constant (addr,
  2023.                           (bitpos / BITS_PER_UNIT)));
  2024.       MEM_IN_STRUCT_P (to_rtx) = 1;
  2025.  
  2026.       return store_expr (exp, to_rtx, value_mode != VOIDmode);
  2027.     }
  2028. }
  2029.  
  2030. /* Given an rtx VALUE that may contain additions and multiplications,
  2031.    return an equivalent value that just refers to a register or memory.
  2032.    This is done by generating instructions to perform the arithmetic
  2033.    and returning a pseudo-register containing the value.  */
  2034.  
  2035. rtx
  2036. force_operand (value, target)
  2037.      rtx value, target;
  2038. {
  2039.   register optab binoptab = 0;
  2040.   register rtx op2;
  2041.   /* Use subtarget as the target for operand 0 of a binary operation.  */
  2042.   register rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
  2043.  
  2044.   if (GET_CODE (value) == PLUS)
  2045.     binoptab = add_optab;
  2046.   else if (GET_CODE (value) == MINUS)
  2047.     binoptab = sub_optab;
  2048.   else if (GET_CODE (value) == MULT)
  2049.     {
  2050.       op2 = XEXP (value, 1);
  2051.       if (!CONSTANT_P (op2)
  2052.       && !(GET_CODE (op2) == REG && op2 != subtarget))
  2053.     subtarget = 0;
  2054.       return expand_mult (GET_MODE (value),
  2055.               force_operand (XEXP (value, 0), subtarget),
  2056.               force_operand (op2, 0),
  2057.               target, 0);
  2058.     }
  2059.  
  2060.   if (binoptab)
  2061.     {
  2062.       op2 = XEXP (value, 1);
  2063.       if (!CONSTANT_P (op2)
  2064.       && !(GET_CODE (op2) == REG && op2 != subtarget))
  2065.     subtarget = 0;
  2066.       if (binoptab == sub_optab
  2067.       && GET_CODE (op2) == CONST_INT && INTVAL (op2) < 0)
  2068.     {
  2069.       binoptab = add_optab;
  2070.       op2 = gen_rtx (CONST_INT, VOIDmode, - INTVAL (op2));
  2071.     }
  2072.       return expand_binop (GET_MODE (value), binoptab,
  2073.                force_operand (XEXP (value, 0), subtarget),
  2074.                force_operand (op2, 0),
  2075.                target, 0, OPTAB_LIB_WIDEN);
  2076.       /* We give UNSIGNEP = 0 to expand_binop
  2077.      because the only operations we are expanding here are signed ones.  */
  2078.     }
  2079.   return value;
  2080. }
  2081.  
  2082. /* expand_expr: generate code for computing expression EXP.
  2083.    An rtx for the computed value is returned.  The value is never null.
  2084.    In the case of a void EXP, const0_rtx is returned.
  2085.  
  2086.    The value may be stored in TARGET if TARGET is nonzero.
  2087.    TARGET is just a suggestion; callers must assume that
  2088.    the rtx returned may not be the same as TARGET.
  2089.  
  2090.    If TARGET is CONST0_RTX, it means that the value will be ignored.
  2091.  
  2092.    If TMODE is not VOIDmode, it suggests generating the
  2093.    result in mode TMODE.  But this is done only when convenient.
  2094.    Otherwise, TMODE is ignored and the value generated in its natural mode.
  2095.    TMODE is just a suggestion; callers must assume that
  2096.    the rtx returned may not have mode TMODE.
  2097.  
  2098.    If MODIFIER is EXPAND_SUM then when EXP is an addition
  2099.    we can return an rtx of the form (MULT (REG ...) (CONST_INT ...))
  2100.    or a nest of (PLUS ...) and (MINUS ...) where the terms are
  2101.    products as above, or REG or MEM, or constant.
  2102.    Ordinarily in such cases we would output mul or add instructions
  2103.    and then return a pseudo reg containing the sum.
  2104.  
  2105.    If MODIFIER is EXPAND_CONST_ADDRESS then it is ok to return
  2106.    a MEM rtx whose address is a constant that isn't a legitimate address.  */
  2107.  
  2108. /* Subroutine of expand_expr:
  2109.    save the non-copied parts (LIST) of an expr (LHS), and return a list
  2110.    which can restore these values to their previous values,
  2111.    should something modify their storage.  */
  2112. static tree
  2113. save_noncopied_parts (lhs, list)
  2114.      tree lhs;
  2115.      tree list;
  2116. {
  2117.   tree tail;
  2118.   tree parts = 0;
  2119.  
  2120.   for (tail = list; tail; tail = TREE_CHAIN (tail))
  2121.     if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
  2122.       parts = chainon (parts, save_noncopied_parts (lhs, TREE_VALUE (tail)));
  2123.     else
  2124.       {
  2125.     tree part = TREE_VALUE (tail);
  2126.     tree part_type = TREE_TYPE (part);
  2127.     tree to_be_saved = build (COMPONENT_REF, part_type, lhs, part, 0);
  2128.     rtx target = assign_stack_local (TYPE_MODE (part_type),
  2129.                      int_size_in_bytes (part_type));
  2130.     if (! memory_address_p (TYPE_MODE (part_type), XEXP (target, 0)))
  2131.       target = change_address (target, TYPE_MODE (part_type), 0);
  2132.     parts = tree_cons (to_be_saved,
  2133.                build (RTL_EXPR, part_type, 0, (tree) target),
  2134.                parts);
  2135.     store_expr (TREE_PURPOSE (parts), RTL_EXPR_RTL (TREE_VALUE (parts)), 0);
  2136.       }
  2137.   return parts;
  2138. }
  2139.  
  2140. /* Subroutine of expand_expr:
  2141.    save the non-copied parts (LIST) of an expr (LHS), and return a list
  2142.    which can restore these values to their previous values,
  2143.    should something modify their storage.  */
  2144. static tree
  2145. init_noncopied_parts (lhs, list)
  2146.      tree lhs;
  2147.      tree list;
  2148. {
  2149.   tree tail;
  2150.   tree parts = 0;
  2151.  
  2152.   for (tail = list; tail; tail = TREE_CHAIN (tail))
  2153.     if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
  2154.       parts = chainon (parts, init_noncopied_parts (lhs, TREE_VALUE (tail)));
  2155.     else
  2156.       {
  2157.     tree part = TREE_VALUE (tail);
  2158.     tree part_type = TREE_TYPE (part);
  2159.     tree to_be_initialized = build (COMPONENT_REF, part_type, lhs, part, 0);
  2160.     parts = tree_cons (TREE_PURPOSE (tail), to_be_initialized, parts);
  2161.       }
  2162.   return parts;
  2163. }
  2164.  
  2165. /* Subroutine of expand_expr:
  2166.    return the target to use when recursively expanding
  2167.    the first operand of an arithmetic operation.  */
  2168.  
  2169. static rtx
  2170. validate_subtarget (subtarget, otherop)
  2171.      rtx subtarget;
  2172.      tree otherop;
  2173. {
  2174.   if (TREE_LITERAL (otherop))
  2175.     return subtarget;
  2176.   if (TREE_CODE (otherop) == VAR_DECL
  2177.       && DECL_RTL (otherop) != subtarget)
  2178.     return subtarget;
  2179.   return 0;
  2180. }
  2181.  
  2182. static int
  2183. fixed_type_p (exp)
  2184.      tree exp;
  2185. {
  2186.   if (TREE_CODE (exp) == PARM_DECL
  2187.       || TREE_CODE (exp) == VAR_DECL
  2188.       || TREE_CODE (exp) == CALL_EXPR || TREE_CODE (exp) == NEW_EXPR
  2189.       || TREE_CODE (exp) == COMPONENT_REF
  2190.       || TREE_CODE (exp) == ARRAY_REF)
  2191.     return 1;
  2192.   return 0;
  2193. }
  2194.  
  2195. rtx
  2196. expand_expr (exp, target, tmode, modifier)
  2197.      register tree exp;
  2198.      rtx target;
  2199.      enum machine_mode tmode;
  2200.      enum expand_modifier modifier;
  2201. {
  2202.   extern rtx (*lang_expand_expr)();
  2203.   register rtx op0, op1, temp;
  2204.   tree type = TREE_TYPE (exp);
  2205.   register enum machine_mode mode = TYPE_MODE (type);
  2206.   register enum tree_code code = TREE_CODE (exp);
  2207.   optab this_optab;
  2208.   int negate_1;
  2209.   /* Use subtarget as the target for operand 0 of a binary operation.  */
  2210.   rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
  2211.   rtx original_target = target;
  2212.   int ignore = target == const0_rtx;
  2213.  
  2214.   /* Don't use hard regs as subtargets, because the combiner
  2215.      can only handle pseudo regs.  */
  2216.   if (subtarget && REGNO (subtarget) < FIRST_PSEUDO_REGISTER)
  2217.     subtarget = 0;
  2218.   /* Avoid subtargets inside loops,
  2219.      since they hide some invariant expressions.  */
  2220.   if (optimize && inside_loop ())
  2221.     subtarget = 0;
  2222.  
  2223.   if (ignore) target = 0, original_target = 0;
  2224.  
  2225.   /* If will do cse, generate all results into registers
  2226.      since 1) that allows cse to find more things
  2227.      and 2) otherwise cse could produce an insn the machine
  2228.      cannot support.  */
  2229.  
  2230.   if (! cse_not_expected && mode != BLKmode)
  2231.     target = subtarget;
  2232.  
  2233.   /* No sense saving up arithmetic to be done
  2234.      if it's all in the wrong mode to form part of an address.
  2235.      And force_operand won't know whether to sign-extend or zero-extend.  */
  2236.  
  2237.   if (mode != Pmode && modifier == EXPAND_SUM)
  2238.     modifier = EXPAND_NORMAL;
  2239.  
  2240.   switch (code)
  2241.     {
  2242.     case PARM_DECL:
  2243.       if (DECL_RTL (exp) == 0)
  2244.     {
  2245.       error_with_decl (exp, "prior parameter's size depends on `%s'");
  2246.       return const0_rtx;
  2247.     }
  2248.  
  2249.     case FUNCTION_DECL:
  2250.     case VAR_DECL:
  2251.     case RESULT_DECL:
  2252.       if (DECL_RTL (exp) == 0)
  2253.     abort ();
  2254.       /* Must mark EXP used because it might be a compiler-generated
  2255.      variable used by a compiler-generated expression.  */
  2256.       TREE_USED (exp) = 1;
  2257.       /* This is the case of an array whose size is to be determined
  2258.      from its initializer, while the initializer is still being parsed.
  2259.      See expand_decl.  */
  2260.       if (GET_CODE (DECL_RTL (exp)) == MEM
  2261.       && GET_CODE (XEXP (DECL_RTL (exp), 0)) == REG)
  2262.     return change_address (DECL_RTL (exp), GET_MODE (DECL_RTL (exp)),
  2263.                    XEXP (DECL_RTL (exp), 0));
  2264.       if (GET_CODE (DECL_RTL (exp)) == MEM
  2265.       && modifier != EXPAND_CONST_ADDRESS)
  2266.     {
  2267.       /* DECL_RTL probably contains a constant address.
  2268.          On RISC machines where a constant address isn't valid,
  2269.          make some insns to get that address into a register.  */
  2270.       if (!memory_address_p (DECL_MODE (exp), XEXP (DECL_RTL (exp), 0))
  2271.           || (flag_force_addr
  2272.           && CONSTANT_ADDRESS_P (XEXP (DECL_RTL (exp), 0))))
  2273.         return change_address (DECL_RTL (exp), VOIDmode,
  2274.                    copy_rtx (XEXP (DECL_RTL (exp), 0)));
  2275.     }
  2276.       return DECL_RTL (exp);
  2277.  
  2278.     case INTEGER_CST:
  2279.       if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_INT)
  2280.     return gen_rtx (CONST_INT, VOIDmode, TREE_INT_CST_LOW (exp));
  2281.       /* Generate immediate CONST_DOUBLE
  2282.      which will be turned into memory by reload if necessary.  */
  2283.       return immed_double_const (TREE_INT_CST_LOW (exp),
  2284.                  TREE_INT_CST_HIGH (exp),
  2285.                  mode);
  2286.  
  2287.     case CONST_DECL:
  2288.       return expand_expr (DECL_INITIAL (exp), target, VOIDmode, 0);
  2289.  
  2290.     case REAL_CST:
  2291.       /* If optimized, generate immediate CONST_DOUBLE
  2292.      which will be turned into memory by reload if necessary.  */
  2293.       if (!cse_not_expected)
  2294.     return immed_real_const (exp);
  2295.     case COMPLEX_CST:
  2296.     case STRING_CST:
  2297.       if (! TREE_CST_RTL (exp))
  2298.     output_constant_def (exp);
  2299.  
  2300.       /* TREE_CST_RTL probably contains a constant address.
  2301.      On RISC machines where a constant address isn't valid,
  2302.      make some insns to get that address into a register.  */
  2303.       if (GET_CODE (TREE_CST_RTL (exp)) == MEM
  2304.       && modifier != EXPAND_CONST_ADDRESS
  2305.       && !memory_address_p (mode, XEXP (TREE_CST_RTL (exp), 0)))
  2306.     return change_address (TREE_CST_RTL (exp), VOIDmode,
  2307.                    copy_rtx (XEXP (TREE_CST_RTL (exp), 0)));
  2308.       return TREE_CST_RTL (exp);
  2309.  
  2310.     case SAVE_EXPR:
  2311.       if (SAVE_EXPR_RTL (exp) == 0)
  2312.     {
  2313.       if (mode == BLKmode)
  2314.         temp
  2315.           = assign_stack_local (mode,
  2316.                     int_size_in_bytes (TREE_TYPE (exp)), 0);
  2317.       else
  2318.         temp = gen_reg_rtx (mode);
  2319.       SAVE_EXPR_RTL (exp) = temp;
  2320.       store_expr (TREE_OPERAND (exp, 0), temp, 0);
  2321.       if (!optimize && GET_CODE (temp) == REG)
  2322.         save_expr_regs = gen_rtx (EXPR_LIST, VOIDmode, temp,
  2323.                       save_expr_regs);
  2324.     }
  2325.       /* Don't let the same rtl node appear in two places.  */
  2326.       return SAVE_EXPR_RTL (exp);
  2327.  
  2328.     case IF_STMT:
  2329.       emit_line_note (STMT_SOURCE_FILE (exp), STMT_SOURCE_LINE (exp));
  2330.  
  2331.       /* Exit flag is 0 for now.  */
  2332.       expand_start_cond (STMT_COND (exp), 0);
  2333.       expand_expr_stmt (STMT_THEN (exp));
  2334.       if (STMT_ELSE (exp) == 0)
  2335.     expand_end_cond ();
  2336.       else
  2337.     {
  2338.       expand_start_else ();
  2339.       expand_expr_stmt (STMT_ELSE (exp));
  2340.       expand_end_else ();
  2341.     }
  2342.       return const0_rtx;
  2343.  
  2344.     case LOOP_STMT:
  2345.       {
  2346.     tree vars = STMT_LOOP_VARS (exp);
  2347.  
  2348.     emit_line_note (STMT_SOURCE_FILE (exp), STMT_SOURCE_LINE (exp));
  2349.  
  2350.     while (vars)
  2351.       {
  2352.         if (DECL_RTL (vars) == 0)
  2353.           expand_decl (vars);
  2354.         expand_decl_init (vars);
  2355.         vars = TREE_CHAIN (vars);
  2356.       }
  2357.  
  2358.     if (TREE_READONLY (exp))
  2359.       {
  2360.         /* Looks like a `while-do' loop.  */
  2361.         expand_start_loop (1);
  2362.         expand_exit_loop_if_false (STMT_LOOP_COND (exp));
  2363.         expand_expr_stmt (STMT_LOOP_BODY (exp));
  2364.         expand_end_loop ();
  2365.       }
  2366.     else
  2367.       {
  2368.         /* Looks like a `do-while' loop.  */
  2369.         expand_start_loop_continue_elsewhere (1);
  2370.         expand_expr_stmt (STMT_LOOP_BODY (exp));
  2371.         expand_loop_continue_here ();
  2372.         expand_exit_loop_if_false (STMT_LOOP_COND (exp));
  2373.         expand_end_loop ();
  2374.       }
  2375.  
  2376.     if (obey_regdecls)
  2377.       for (vars = STMT_LOOP_VARS (exp); vars; vars = TREE_CHAIN (vars))
  2378.         use_variable (DECL_RTL (vars));
  2379.       }
  2380.       return const0_rtx;
  2381.  
  2382.     case LET_STMT:
  2383.       {
  2384.     tree vars = STMT_VARS (exp);
  2385.  
  2386.     TREE_USED (exp) = 1;
  2387.  
  2388.     /* If VARS have not yet been expanded, expand them now.  */
  2389.     while (vars)
  2390.       {
  2391.         if (DECL_RTL (vars) == 0)
  2392.           expand_decl (vars);
  2393.         /* Have to initialize these vars whereever this LET_STMT
  2394.            is expanded.  */
  2395.         expand_decl_init (vars);
  2396.         vars = TREE_CHAIN (vars);
  2397.       }
  2398.  
  2399.     temp = expand_expr (STMT_BODY (exp), target, tmode, modifier);
  2400.  
  2401.     if (obey_regdecls)
  2402.       for (vars = STMT_VARS (exp); vars; vars = TREE_CHAIN (vars))
  2403.         /* TYPE_DECLs do not have rtl.  */
  2404.         if (DECL_RTL (vars))
  2405.           use_variable (DECL_RTL (vars));
  2406.  
  2407.     return temp;
  2408.       }
  2409.  
  2410.     case RTL_EXPR:
  2411.       if (RTL_EXPR_SEQUENCE (exp) == const0_rtx)
  2412.     abort ();
  2413.       emit_insns (RTL_EXPR_SEQUENCE (exp));
  2414.       RTL_EXPR_SEQUENCE (exp) = const0_rtx;
  2415.       return RTL_EXPR_RTL (exp);
  2416.  
  2417.     case CONSTRUCTOR:
  2418.       /* All elts simple constants => refer to a constant in memory.  */
  2419.       if (TREE_STATIC (exp))
  2420.     /* For aggregate types with non-BLKmode modes,
  2421.        this should ideally construct a CONST_INT.  */
  2422.     {
  2423.       rtx constructor = output_constant_def (exp);
  2424.       if (! memory_address_p (GET_MODE (constructor),
  2425.                   XEXP (constructor, 0)))
  2426.         constructor = change_address (constructor, VOIDmode,
  2427.                       XEXP (constructor, 0));
  2428.       return constructor;
  2429.     }
  2430.  
  2431.       if (ignore)
  2432.     {
  2433.       tree elt;
  2434.       for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
  2435.         expand_expr (TREE_VALUE (elt), const0_rtx, VOIDmode, 0);
  2436.       return const0_rtx;
  2437.     }
  2438.       else
  2439.     {
  2440.       if (target == 0)
  2441.         target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  2442.                   get_structure_value_addr (expr_size (exp)));
  2443.       store_expr (exp, target, 0);
  2444.       return target;
  2445.     }
  2446.  
  2447.     case INDIRECT_REF:
  2448.       {
  2449.     tree exp1 = TREE_OPERAND (exp, 0);
  2450.     tree exp2;
  2451.  
  2452.     /* A SAVE_EXPR as the address in an INDIRECT_EXPR is generated
  2453.        for  *PTR += ANYTHING  where PTR is put inside the SAVE_EXPR.
  2454.        This code has the same general effect as simply doing
  2455.        expand_expr on the save expr, except that the expression PTR
  2456.        is computed for use as a memory address.  This means different
  2457.        code, suitable for indexing, may be generated.  */
  2458.     if (TREE_CODE (exp1) == SAVE_EXPR
  2459.         && SAVE_EXPR_RTL (exp1) == 0
  2460.         && TREE_CODE (exp2 = TREE_OPERAND (exp1, 0)) != ERROR_MARK
  2461.         && TYPE_MODE (TREE_TYPE (exp1)) == Pmode
  2462.         && TYPE_MODE (TREE_TYPE (exp2)) == Pmode)
  2463.       {
  2464.         temp = expand_expr (TREE_OPERAND (exp1, 0), 0, VOIDmode, EXPAND_SUM);
  2465.         op0 = memory_address (mode, temp);
  2466.         op0 = copy_all_regs (op0);
  2467.         SAVE_EXPR_RTL (exp1) = op0;
  2468.       }
  2469.     else
  2470.       {
  2471.         if (modifier == EXPAND_INTO_STACK
  2472.         && original_target
  2473.         && GET_CODE (original_target) == MEM)
  2474.           op0 = expand_expr (exp1, XEXP (original_target, 0),
  2475.                  VOIDmode, EXPAND_INTO_STACK);
  2476.         else
  2477.           op0 = expand_expr (exp1, 0, VOIDmode, EXPAND_SUM);
  2478.         op0 = memory_address (mode, op0);
  2479.       }
  2480.       }
  2481.       temp = gen_rtx (MEM, mode, op0);
  2482.       /* If address was computed by addition,
  2483.      mark this as an element of an aggregate.  */
  2484.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
  2485.       || (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR
  2486.           && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR))
  2487.     MEM_IN_STRUCT_P (temp) = 1;
  2488.       MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) || flag_volatile;
  2489.       RTX_UNCHANGING_P (temp) = TREE_READONLY (exp);
  2490.       return temp;
  2491.  
  2492.     case ARRAY_REF:
  2493.       if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST
  2494.       || TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST)
  2495.     {
  2496.       /* Nonconstant array index or nonconstant element size.
  2497.          Generate the tree for *(&array+index) and expand that,
  2498.          except do it in a language-independent way
  2499.          and don't complain about non-lvalue arrays.
  2500.          `mark_addressable' should already have been called
  2501.          for any array for which this case will be reached.  */
  2502.  
  2503.       tree array_adr = build1 (ADDR_EXPR, TYPE_POINTER_TO (type),
  2504.                    TREE_OPERAND (exp, 0));
  2505.       tree index = TREE_OPERAND (exp, 1);
  2506.       tree elt;
  2507.  
  2508.       /* Convert the integer argument to a type the same size as a pointer
  2509.          so the multiply won't overflow spuriously.  */
  2510.       if (TYPE_PRECISION (TREE_TYPE (index)) != POINTER_SIZE)
  2511.         index = convert (type_for_size (POINTER_SIZE, 0), index);
  2512.  
  2513.       /* The array address isn't volatile even if the array is.  */
  2514.       TREE_VOLATILE (array_adr) = 0;
  2515.  
  2516.       elt = build1 (INDIRECT_REF, type,
  2517.             fold (build (PLUS_EXPR, TYPE_POINTER_TO (type),
  2518.                      array_adr,
  2519.                      fold (build (MULT_EXPR,
  2520.                           TYPE_POINTER_TO (type),
  2521.                           index, size_in_bytes (type))))));
  2522.  
  2523.       return expand_expr (elt, target, tmode, modifier);
  2524.     }
  2525.  
  2526.       /* Fold an expression like: "foo"[2].
  2527.      This is not done in fold so it won't happen inside &.  */
  2528.       {
  2529.     int i;
  2530.     tree arg0 = TREE_OPERAND (exp, 0);
  2531.     tree arg1 = TREE_OPERAND (exp, 1);
  2532.  
  2533.     if (TREE_CODE (arg0) == STRING_CST
  2534.         && TREE_CODE (arg1) == INTEGER_CST
  2535.         && !TREE_INT_CST_HIGH (arg1)
  2536.         && (i = TREE_INT_CST_LOW (arg1)) < TREE_STRING_LENGTH (arg0))
  2537.       {
  2538.         if (TREE_TYPE (TREE_TYPE (arg0)) == integer_type_node)
  2539.           {
  2540.         exp = build_int_2 (((int *)TREE_STRING_POINTER (arg0))[i], 0);
  2541.         TREE_TYPE (exp) = integer_type_node;
  2542.         return expand_expr (exp, target, tmode, modifier);
  2543.           }
  2544.         if (TREE_TYPE (TREE_TYPE (arg0)) == char_type_node)
  2545.           {
  2546.         exp = build_int_2 (TREE_STRING_POINTER (arg0)[i], 0);
  2547.         TREE_TYPE (exp) = integer_type_node;
  2548.         return expand_expr (convert (TREE_TYPE (TREE_TYPE (arg0)), exp), target, tmode, modifier);
  2549.           }
  2550.       }
  2551.       }
  2552.  
  2553.       /* If this is a constant index into a constant array,
  2554.      just get the value from the array.  */
  2555.       if (TREE_READONLY (TREE_OPERAND (exp, 0))
  2556.       && ! TREE_VOLATILE (TREE_OPERAND (exp, 0))
  2557.       && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == ARRAY_TYPE
  2558.       && TREE_LITERAL (TREE_OPERAND (exp, 1))
  2559.       && TREE_CODE (TREE_OPERAND (exp, 0)) == VAR_DECL
  2560.       && DECL_INITIAL (TREE_OPERAND (exp, 0))
  2561.       && TREE_CODE (DECL_INITIAL (TREE_OPERAND (exp, 0))) != ERROR_MARK)
  2562.     {
  2563.       tree index = fold (TREE_OPERAND (exp, 1));
  2564.       if (TREE_CODE (index) == INTEGER_CST)
  2565.         {
  2566.           int i = TREE_INT_CST_LOW (index);
  2567.           tree init = CONSTRUCTOR_ELTS (DECL_INITIAL (TREE_OPERAND (exp, 0)));
  2568.  
  2569.           while (init && i--)
  2570.         init = TREE_CHAIN (init);
  2571.           if (init)
  2572.         return expand_expr (fold (TREE_VALUE (init)), target, tmode, modifier);
  2573.         }
  2574.     }
  2575.       /* Treat array-ref with constant index as a component-ref.  */
  2576.  
  2577.     case COMPONENT_REF:
  2578.       {
  2579.     register enum machine_mode mode1;
  2580.     int volstruct = 0;
  2581.     int bitsize;
  2582.     tree tem = exp;
  2583.     int bitpos = 0;
  2584.     int unsignedp;
  2585.  
  2586.     if (TREE_CODE (exp) == COMPONENT_REF)
  2587.       {
  2588.         tree field = TREE_OPERAND (exp, 1);
  2589.         bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) * DECL_SIZE_UNIT (field);
  2590.         mode1 = DECL_MODE (field);
  2591.         unsignedp = TREE_UNSIGNED (field);
  2592.       }
  2593.     else
  2594.       {
  2595.         mode1 = TYPE_MODE (TREE_TYPE (exp));
  2596.         bitsize = GET_MODE_BITSIZE (mode1);
  2597.         unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  2598.       }
  2599.  
  2600.     /* Compute cumulative bit-offset for nested component-refs
  2601.        and array-refs, and find the ultimate containing object.  */
  2602.  
  2603.     while (1)
  2604.       {
  2605.         if (TREE_CODE (tem) == COMPONENT_REF)
  2606.           {
  2607.         bitpos += DECL_OFFSET (TREE_OPERAND (tem, 1));
  2608.         if (TREE_THIS_VOLATILE (tem))
  2609.           volstruct = 1;
  2610.           }
  2611.         else if (TREE_CODE (tem) == ARRAY_REF
  2612.              && TREE_CODE (TREE_OPERAND (tem, 1)) == INTEGER_CST
  2613.              && TREE_CODE (TYPE_SIZE (TREE_TYPE (tem))) == INTEGER_CST)
  2614.           {
  2615.         bitpos += (TREE_INT_CST_LOW (TREE_OPERAND (tem, 1))
  2616.                * TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)))
  2617.                * TYPE_SIZE_UNIT (TREE_TYPE (tem)));
  2618.           }
  2619.         else
  2620.           break;
  2621.         tem = TREE_OPERAND (tem, 0);
  2622.       }
  2623.  
  2624.     op0 = expand_expr (tem, 0, VOIDmode,
  2625.                (modifier == EXPAND_CONST_ADDRESS
  2626.                 ? modifier : EXPAND_NORMAL));
  2627.  
  2628.     if (mode1 == BImode || GET_CODE (op0) == REG
  2629.         || GET_CODE (op0) == SUBREG)
  2630.       return extract_bit_field (op0, bitsize, bitpos, unsignedp,
  2631.                     target, mode, tmode,
  2632.                     TYPE_ALIGN (TREE_TYPE (tem)) / BITS_PER_UNIT);
  2633.     /* Get a reference to just this component.  */
  2634.     if (modifier == EXPAND_CONST_ADDRESS)
  2635.       op0 = gen_rtx (MEM, mode1, plus_constant (XEXP (op0, 0),
  2636.                             (bitpos / BITS_PER_UNIT)));
  2637.     else
  2638.       op0 = change_address (op0, mode1,
  2639.                 plus_constant (XEXP (op0, 0),
  2640.                            (bitpos / BITS_PER_UNIT)));
  2641.     MEM_IN_STRUCT_P (op0) = 1;
  2642.     MEM_VOLATILE_P (op0) |= volstruct;
  2643.     /* If OP0 is in the shared structure-value stack slot,
  2644.        and it is not BLKmode, copy it into a register.
  2645.        The shared slot may be clobbered at any time by another call.
  2646.        BLKmode is safe because our caller will either copy the value away
  2647.        or take another component and come back here.  */
  2648.     if (mode != BLKmode
  2649.         && TREE_CODE (TREE_OPERAND (exp, 0)) == CALL_EXPR
  2650.         && TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == BLKmode)
  2651.       op0 = copy_to_reg (op0);
  2652.     if (mode == mode1 || mode1 == BLKmode || mode1 == tmode)
  2653.       return op0;
  2654.     if (target == 0)
  2655.       target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
  2656.     convert_move (target, op0, unsignedp);
  2657.     return target;
  2658.       }
  2659.  
  2660.       /* Intended for a reference to a buffer of a file-object in Pascal.
  2661.      But it's not certain that a special tree code will really be
  2662.      necessary for these.  INDIRECT_REF might work for them.  */
  2663.     case BUFFER_REF:
  2664.       abort ();
  2665.  
  2666.     case WITH_CLEANUP_EXPR:
  2667.       if (RTL_EXPR_RTL (exp) == 0)
  2668.     {
  2669.       RTL_EXPR_RTL (exp)
  2670.         = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
  2671.       cleanups_this_call = tree_cons (0, TREE_OPERAND (exp, 2), cleanups_this_call);
  2672.       /* That's it for this cleanup.  */
  2673.       TREE_OPERAND (exp, 2) = 0;
  2674.     }
  2675.       return RTL_EXPR_RTL (exp);
  2676.  
  2677.     case OFFSET_REF:
  2678.       return expand_expr (resolve_offset_ref (exp), target, tmode, modifier);
  2679.  
  2680.     case CALL_EXPR:
  2681.       /* Check for a built-in function.  */
  2682.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
  2683.       && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == FUNCTION_DECL
  2684.       && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
  2685.           != NOT_BUILT_IN))
  2686.     return expand_builtin (exp, target, subtarget, tmode, ignore);
  2687.       /* If this call was expanded already by preexpand_calls,
  2688.      just return the result we got.  */
  2689.       if (CALL_EXPR_RTL (exp) != 0)
  2690.     return CALL_EXPR_RTL (exp);
  2691.       return expand_call (exp,
  2692.               (modifier == EXPAND_INTO_STACK) ? original_target : target,
  2693.               ignore, modifier);
  2694.  
  2695.     case NOP_EXPR:
  2696.     case CONVERT_EXPR:
  2697.     case REFERENCE_EXPR:
  2698.       if (TREE_CODE (type) == VOID_TYPE || ignore)
  2699.     {
  2700.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);
  2701.       return const0_rtx;
  2702.     }
  2703.       if (mode == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  2704.     return expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, modifier);
  2705.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, mode, 0);
  2706.       if (GET_MODE (op0) == mode || GET_MODE (op0) == VOIDmode)
  2707.     return op0;
  2708.       if (flag_force_mem && GET_CODE (op0) == MEM)
  2709.     op0 = copy_to_reg (op0);
  2710.       if (GET_MODE (op0) == VOIDmode)
  2711.     /* Avoid problem in convert_move due to unknown mode of OP0.  */
  2712.     op0 = copy_to_mode_reg (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
  2713.                 op0);
  2714.       if (target == 0)
  2715.     target = gen_reg_rtx (mode);
  2716.       convert_move (target, op0, TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
  2717.       return target;
  2718.  
  2719.     case PLUS_EXPR:
  2720.       preexpand_calls (exp);
  2721.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST
  2722.       && modifier == EXPAND_SUM)
  2723.     {
  2724.       op1 = expand_expr (TREE_OPERAND (exp, 1), subtarget, VOIDmode, EXPAND_SUM);
  2725.       op1 = plus_constant (op1, TREE_INT_CST_LOW (TREE_OPERAND (exp, 0)));
  2726.       return op1;
  2727.     }
  2728.       negate_1 = 1;
  2729.     plus_minus:
  2730.       if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  2731.       && modifier == EXPAND_SUM)
  2732.     {
  2733.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
  2734.       op0 = plus_constant (op0,
  2735.                    negate_1 * TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)));
  2736.       return op0;
  2737.     }
  2738.       this_optab = add_optab;
  2739.       if (modifier != EXPAND_SUM) goto binop;
  2740.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2741.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
  2742.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, EXPAND_SUM);
  2743.       /* Put a sum last, to simplify what follows.  */
  2744. #ifdef OLD_INDEXING
  2745.       if (GET_CODE (op1) == MULT)
  2746.     {
  2747.       temp = op0;
  2748.       op0 = op1;
  2749.       op1 = temp;
  2750.     }
  2751. #endif
  2752. #ifndef OLD_INDEXING
  2753.       /* Make sure any term that's a sum with a constant comes last.  */
  2754.       if (GET_CODE (op0) == PLUS
  2755.       && CONSTANT_P (XEXP (op0, 1)))
  2756.     {
  2757.       temp = op0;
  2758.       op0 = op1;
  2759.       op1 = temp;
  2760.     }
  2761.       /* If adding to a sum including a constant,
  2762.      associate it to put the constant outside.  */
  2763.       if (GET_CODE (op1) == PLUS
  2764.       && CONSTANT_P (XEXP (op1, 1)))
  2765.     {
  2766.       rtx tem;
  2767.       int constant_term = 0;
  2768.  
  2769.       op0 = gen_rtx (PLUS, mode, XEXP (op1, 0), op0);
  2770.       /* Let's also eliminate constants from op0 if possible.  */
  2771.       tem = eliminate_constant_term (op0, &constant_term);
  2772.       if (GET_CODE (XEXP (op1, 1)) == CONST_INT)
  2773.         {
  2774.           if (constant_term != 0)
  2775.         return plus_constant (tem, INTVAL (XEXP (op1, 1)) + constant_term);
  2776.           else
  2777.         return plus_constant (op0, INTVAL (XEXP (op1, 1)));
  2778.         }
  2779.       else
  2780.         return gen_rtx (PLUS, mode, op0, XEXP (op1, 1));
  2781.     }
  2782. #endif
  2783.       return gen_rtx (PLUS, mode, op0, op1);
  2784.  
  2785.     case MINUS_EXPR:
  2786.       preexpand_calls (exp);
  2787.       if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  2788.       && GET_MODE_BITSIZE (TYPE_MODE (type)) <= HOST_BITS_PER_INT)
  2789.     {
  2790.       int negated;
  2791.       if (modifier == EXPAND_SUM)
  2792.         {
  2793.           negate_1 = -1;
  2794.           goto plus_minus;
  2795.         }
  2796.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2797.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  2798.       negated = - TREE_INT_CST_LOW (TREE_OPERAND (exp, 1));
  2799.       if (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_INT)
  2800.         negated &= (1 << GET_MODE_BITSIZE (mode)) - 1;
  2801.       op1 = gen_rtx (CONST_INT, VOIDmode, negated);
  2802.       this_optab = add_optab;
  2803.       goto binop2;
  2804.     }
  2805.       this_optab = sub_optab;
  2806.       goto binop;
  2807.  
  2808.     case MULT_EXPR:
  2809.       preexpand_calls (exp);
  2810.       /* If first operand is constant, swap them.
  2811.      Thus the following special case checks need only
  2812.      check the second operand.  */
  2813.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST)
  2814.     {
  2815.       register tree t1 = TREE_OPERAND (exp, 0);
  2816.       TREE_OPERAND (exp, 0) = TREE_OPERAND (exp, 1);
  2817.       TREE_OPERAND (exp, 1) = t1;
  2818.     }
  2819.  
  2820.       /* Attempt to return something suitable for generating an
  2821.      indexed address, for machines that support that.  */
  2822.  
  2823.       if (modifier == EXPAND_SUM
  2824.       && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
  2825.     {
  2826.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
  2827.  
  2828.       /* Apply distributive law if OP0 is x+c.  */
  2829.       if (GET_CODE (op0) == PLUS
  2830.           && GET_CODE (XEXP (op0, 1)) == CONST_INT)
  2831.         return gen_rtx (PLUS, mode,
  2832.                 gen_rtx (MULT, mode, XEXP (op0, 0),
  2833.                      gen_rtx (CONST_INT, VOIDmode,
  2834.                           TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))),
  2835.                 gen_rtx (CONST_INT, VOIDmode,
  2836.                      (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))
  2837.                       * INTVAL (XEXP (op0, 1)))));
  2838.  
  2839.       if (GET_CODE (op0) != REG)
  2840.         op0 = force_operand (op0, 0);
  2841.       if (GET_CODE (op0) != REG)
  2842.         op0 = copy_to_mode_reg (mode, op0);
  2843.  
  2844.       return gen_rtx (MULT, mode, op0,
  2845.               gen_rtx (CONST_INT, VOIDmode,
  2846.                    TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))));
  2847.     }
  2848.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2849.       /* Check for multiplying things that have been extended
  2850.      from a narrower type.  If this machine supports multiplying
  2851.      in that narrower type with a result in the desired type,
  2852.      do it that way, and avoid the explicit type-conversion.  */
  2853.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == NOP_EXPR
  2854.       && TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
  2855.       && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  2856.           < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0))))
  2857.       && ((TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  2858.            && int_fits_type_p (TREE_OPERAND (exp, 1),
  2859.                    TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  2860.            /* Don't use a widening multiply if a shift will do.  */
  2861.            && exact_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))) < 0)
  2862.           ||
  2863.           (TREE_CODE (TREE_OPERAND (exp, 1)) == NOP_EXPR
  2864.            && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
  2865.            ==
  2866.            TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))))
  2867.            /* If both operands are extended, they must either both
  2868.           be zero-extended or both be sign-extended.  */
  2869.            && (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
  2870.            ==
  2871.            TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))))))
  2872.     {
  2873.       enum machine_mode innermode
  2874.         = TYPE_MODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)));
  2875.       this_optab = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  2876.             ? umul_widen_optab : smul_widen_optab);
  2877.       if (mode == GET_MODE_WIDER_MODE (innermode)
  2878.           && this_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  2879.         {
  2880.           op0 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
  2881.                  0, VOIDmode, 0);
  2882.           if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
  2883.         op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  2884.           else
  2885.         op1 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 1), 0),
  2886.                    0, VOIDmode, 0);
  2887.           goto binop2;
  2888.         }
  2889.     }
  2890.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  2891.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  2892.       return expand_mult (mode, op0, op1, target, TREE_UNSIGNED (type));
  2893.  
  2894.     case TRUNC_DIV_EXPR:
  2895.     case FLOOR_DIV_EXPR:
  2896.     case CEIL_DIV_EXPR:
  2897.     case ROUND_DIV_EXPR:
  2898.     case EXACT_DIV_EXPR:
  2899.       preexpand_calls (exp);
  2900.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2901.       /* Possible optimization: compute the dividend with EXPAND_SUM
  2902.      then if the divisor is constant can optimize the case
  2903.      where some terms of the dividend have coeffs divisible by it.  */
  2904.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  2905.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  2906.       return expand_divmod (0, code, mode, op0, op1, target,
  2907.                 TREE_UNSIGNED (type));
  2908.  
  2909.     case RDIV_EXPR:
  2910.       preexpand_calls (exp);
  2911.       this_optab = flodiv_optab;
  2912.       goto binop;
  2913.  
  2914.     case TRUNC_MOD_EXPR:
  2915.     case FLOOR_MOD_EXPR:
  2916.     case CEIL_MOD_EXPR:
  2917.     case ROUND_MOD_EXPR:
  2918.       preexpand_calls (exp);
  2919.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2920.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  2921.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  2922.       return expand_divmod (1, code, mode, op0, op1, target,
  2923.                 TREE_UNSIGNED (type));
  2924. #if 0
  2925. #ifdef HAVE_divmoddisi4
  2926.       if (GET_MODE (op0) != DImode)
  2927.     {
  2928.       temp = gen_reg_rtx (DImode);
  2929.       convert_move (temp, op0, 0);
  2930.       op0 = temp;
  2931.       if (GET_MODE (op1) != SImode && GET_CODE (op1) != CONST_INT)
  2932.         {
  2933.           temp = gen_reg_rtx (SImode);
  2934.           convert_move (temp, op1, 0);
  2935.           op1 = temp;
  2936.         }
  2937.       temp = gen_reg_rtx (SImode);
  2938.       if (target == 0)
  2939.         target = gen_reg_rtx (SImode);
  2940.       emit_insn (gen_divmoddisi4 (temp, protect_from_queue (op0, 0),
  2941.                       protect_from_queue (op1, 0),
  2942.                       protect_from_queue (target, 1)));
  2943.       return target;
  2944.     }
  2945. #endif
  2946. #endif
  2947.  
  2948.     case FIX_ROUND_EXPR:
  2949.     case FIX_FLOOR_EXPR:
  2950.     case FIX_CEIL_EXPR:
  2951.       abort ();            /* Not used for C.  */
  2952.  
  2953.     case FIX_TRUNC_EXPR:
  2954.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  2955.       if (target == 0)
  2956.     target = gen_reg_rtx (mode);
  2957.       {
  2958.     int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  2959.     if (mode == HImode || mode == QImode)
  2960.       {
  2961.         register rtx temp = gen_reg_rtx (SImode);
  2962.         expand_fix (temp, op0, 0);
  2963.         convert_move (target, temp, 0);
  2964.       }
  2965.     else
  2966.       expand_fix (target, op0, unsignedp);
  2967.       }
  2968.       return target;
  2969.  
  2970.     case FLOAT_EXPR:
  2971.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  2972.       if (target == 0)
  2973.     target = gen_reg_rtx (mode);
  2974.       if (GET_MODE (op0) == VOIDmode)
  2975.     /* Avoid problem in convert_move due to unknown mode of OP0.  */
  2976.     op0 = copy_to_mode_reg (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
  2977.                 op0);
  2978.       {
  2979.     int unsignedp = TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)));
  2980.     if (GET_MODE (op0) == HImode
  2981.         || GET_MODE (op0) == QImode)
  2982.       {
  2983.         register rtx temp = gen_reg_rtx (SImode);
  2984.         convert_move (temp, op0, unsignedp);
  2985.         expand_float (target, temp, 0);
  2986.       }
  2987.     else
  2988.       expand_float (target, op0, unsignedp);
  2989.       }
  2990.       return target;
  2991.  
  2992.     case NEGATE_EXPR:
  2993.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  2994.       temp = expand_unop (mode, neg_optab, op0, target, 0);
  2995.       if (temp == 0)
  2996.     abort ();
  2997.       return temp;
  2998.  
  2999.     case ABS_EXPR:
  3000.       /* First try to do it with a special abs instruction.
  3001.      If that does not win, use conditional jump and negate.  */
  3002.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3003.       temp = expand_unop (mode, abs_optab, op0, target, 0);
  3004.       if (temp != 0)
  3005.     return temp;
  3006.       temp = gen_label_rtx ();
  3007.       if (target == 0 || GET_CODE (target) != REG)
  3008.     target = gen_reg_rtx (mode);
  3009.       emit_move_insn (target, op0);
  3010.       emit_cmp_insn (target,
  3011.              expand_expr (convert (TREE_TYPE (exp), integer_zero_node),
  3012.                   0, VOIDmode, 0),
  3013.              0, 0, 0);
  3014.       NO_DEFER_POP;
  3015.       emit_jump_insn (gen_bge (temp));
  3016.       op0 = expand_unop (mode, neg_optab, target, target, 0);
  3017.       if (op0 != target)
  3018.     emit_move_insn (target, op0);
  3019.       emit_label (temp);
  3020.       OK_DEFER_POP;
  3021.       return target;
  3022.  
  3023.     case MAX_EXPR:
  3024.     case MIN_EXPR:
  3025.       mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1)));
  3026.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  3027.       if (target == 0 || GET_CODE (target) != REG || target == op1)
  3028.     target = gen_reg_rtx (mode);
  3029.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  3030.       if (target != op0)
  3031.     emit_move_insn (target, op0);
  3032.       op0 = gen_label_rtx ();
  3033.       if (code == MAX_EXPR)
  3034.     temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
  3035.         ? compare1 (target, op1, GEU, LEU, 1, mode)
  3036.         : compare1 (target, op1, GE, LE, 0, mode));
  3037.       else
  3038.     temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
  3039.         ? compare1 (target, op1, LEU, GEU, 1, mode)
  3040.         : compare1 (target, op1, LE, GE, 0, mode));
  3041.       if (temp == const0_rtx)
  3042.     emit_move_insn (target, op1);
  3043.       else if (temp != const1_rtx)
  3044.     {
  3045.       if (bcc_gen_fctn[(int) GET_CODE (temp)] != 0)
  3046.         emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (temp)]) (op0));
  3047.       else
  3048.         abort ();
  3049.       emit_move_insn (target, op1);
  3050.     }
  3051.       emit_label (op0);
  3052.       return target;
  3053.  
  3054. /* ??? Can optimize when the operand of this is a bitwise operation,
  3055.    by using a different bitwise operation.  */
  3056.     case BIT_NOT_EXPR:
  3057.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3058.       temp = expand_unop (mode, one_cmpl_optab, op0, target, 1);
  3059.       if (temp == 0)
  3060.     abort ();
  3061.       return temp;
  3062.  
  3063.     case FFS_EXPR:
  3064.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3065.       temp = expand_unop (mode, ffs_optab, op0, target, 1);
  3066.       if (temp == 0)
  3067.     abort ();
  3068.       return temp;
  3069.  
  3070. /* ??? Can optimize bitwise operations with one arg constant.
  3071.    Pastel optimizes (a bitwise1 n) bitwise2 (a bitwise3 b)
  3072.    and (a bitwise1 b) bitwise2 b (etc)
  3073.    but that is probably not worth while.  */
  3074.  
  3075. /* BIT_AND_EXPR is for bitwise anding.
  3076.    TRUTH_AND_EXPR is for anding two boolean values
  3077.    when we want in all cases to compute both of them.
  3078.    In general it is fastest to do TRUTH_AND_EXPR by
  3079.    computing both operands as actual zero-or-1 values
  3080.    and then bitwise anding.  In cases where there cannot
  3081.    be any side effects, better code would be made by
  3082.    treating TRUTH_AND_EXPR like TRUTH_ANDIF_EXPR;
  3083.    but the question is how to recognize those cases.  */
  3084.  
  3085.     case TRUTH_AND_EXPR:
  3086.     case BIT_AND_EXPR:
  3087.       preexpand_calls (exp);
  3088.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  3089.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3090.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  3091.       return expand_bit_and (mode, op0, op1, target);
  3092.  
  3093. /* See comment above about TRUTH_AND_EXPR; it applies here too.  */
  3094.     case TRUTH_OR_EXPR:
  3095.     case BIT_IOR_EXPR:
  3096.       preexpand_calls (exp);
  3097.       this_optab = ior_optab;
  3098.       goto binop;
  3099.  
  3100.     case BIT_XOR_EXPR:
  3101.       preexpand_calls (exp);
  3102.       this_optab = xor_optab;
  3103.       goto binop;
  3104.  
  3105.     case LSHIFT_EXPR:
  3106.     case RSHIFT_EXPR:
  3107.     case LROTATE_EXPR:
  3108.     case RROTATE_EXPR:
  3109.       preexpand_calls (exp);
  3110.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  3111.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3112.       return expand_shift (code, mode, op0, TREE_OPERAND (exp, 1), target,
  3113.                TREE_UNSIGNED (type));
  3114.  
  3115. /* ??? cv's were used to effect here to combine additive constants
  3116.    and to determine the answer when only additive constants differ.
  3117.    Also, the addition of one can be handled by changing the condition.  */
  3118.     case LT_EXPR:
  3119.     case LE_EXPR:
  3120.     case GT_EXPR:
  3121.     case GE_EXPR:
  3122.     case EQ_EXPR:
  3123.     case NE_EXPR:
  3124.       preexpand_calls (exp);
  3125.       temp = do_store_flag (exp, target, mode);
  3126.       if (temp != 0)
  3127.     return temp;
  3128.       /* For foo != 0, load foo, and if it is nonzero load 1 instead. */
  3129.       if (code == NE_EXPR && integer_zerop (TREE_OPERAND (exp, 1))
  3130.       && subtarget
  3131.       && (GET_MODE (subtarget)
  3132.           == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  3133.     {
  3134.       temp = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3135.       if (temp != subtarget)
  3136.         temp = copy_to_reg (temp);
  3137.       op1 = gen_label_rtx ();
  3138.       emit_cmp_insn (temp, const0_rtx, 0, TREE_UNSIGNED (type), 0);
  3139.       emit_jump_insn (gen_beq (op1));
  3140.       emit_move_insn (temp, const1_rtx);
  3141.       emit_label (op1);
  3142.       return temp;
  3143.     }
  3144.       /* If no set-flag instruction, must generate a conditional
  3145.      store into a temporary variable.  Drop through
  3146.      and handle this like && and ||.  */
  3147.  
  3148.     case TRUTH_ANDIF_EXPR:
  3149.     case TRUTH_ORIF_EXPR:
  3150.       temp = gen_reg_rtx (mode);
  3151.       emit_clr_insn (temp);
  3152.       op1 = gen_label_rtx ();
  3153.       jumpifnot (exp, op1);
  3154.       emit_0_to_1_insn (temp);
  3155.       emit_label (op1);
  3156.       return temp;
  3157.  
  3158.     case TRUTH_NOT_EXPR:
  3159.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  3160.       /* The parser is careful to generate TRUTH_NOT_EXPR
  3161.      only with operands that are always zero or one.  */
  3162.       temp = expand_binop (mode, xor_optab, op0,
  3163.                gen_rtx (CONST_INT, mode, 1),
  3164.                target, 1, OPTAB_LIB_WIDEN);
  3165.       if (temp == 0)
  3166.     abort ();
  3167.       return temp;
  3168.  
  3169.     case COMPOUND_EXPR:
  3170.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  3171.       emit_queue ();
  3172.       return expand_expr (TREE_OPERAND (exp, 1), target, VOIDmode, 0);
  3173.  
  3174.     case COND_EXPR:
  3175.       {
  3176.     /* Note that COND_EXPRs whose type is a structure or union
  3177.        are required to be constructed to contain assignments of
  3178.        a temporary variable, so that we can evaluate them here
  3179.        for side effect only.  If type is void, we must do likewise.  */
  3180.  
  3181.     /* If an arm of the branch requires a cleanup, that
  3182.        only that cleanup is performed.  */
  3183.  
  3184.     tree old_cleanups = cleanups_this_call;
  3185.     cleanups_this_call = 0;
  3186.  
  3187.     op0 = gen_label_rtx ();
  3188.     op1 = gen_label_rtx ();
  3189.  
  3190.     if (mode == VOIDmode || ignore)
  3191.       temp = 0;
  3192.     else if (target)
  3193.       temp = target;
  3194.     else if (mode == BLKmode)
  3195.       {
  3196.         if (TYPE_SIZE (type) == 0 || ! TREE_LITERAL (TYPE_SIZE (type)))
  3197.           abort ();
  3198.         temp = assign_stack_local (BLKmode,
  3199.                        (TREE_INT_CST_LOW (TYPE_SIZE (type))
  3200.                     * TYPE_SIZE_UNIT (type)
  3201.                     + BITS_PER_UNIT - 1)
  3202.                        / BITS_PER_UNIT);
  3203.       }
  3204.     else
  3205.       temp = gen_reg_rtx (mode);
  3206.  
  3207.     jumpifnot (TREE_OPERAND (exp, 0), op0);
  3208.     NO_DEFER_POP;
  3209.     if (temp != 0)
  3210.       store_expr (TREE_OPERAND (exp, 1), temp, 0);
  3211.     else
  3212.       expand_expr (TREE_OPERAND (exp, 1), ignore ? const0_rtx : 0,
  3213.                VOIDmode, 0);
  3214.     if (cleanups_this_call)
  3215.       {
  3216.         sorry ("aggreage value in COND_EXPR");
  3217.         cleanups_this_call = 0;
  3218.       }
  3219.  
  3220.     emit_queue ();
  3221.     emit_jump_insn (gen_jump (op1));
  3222.     emit_barrier ();
  3223.     emit_label (op0);
  3224.     if (temp != 0)
  3225.       store_expr (TREE_OPERAND (exp, 2), temp, 0);
  3226.     else
  3227.       expand_expr (TREE_OPERAND (exp, 2), ignore ? const0_rtx : 0,
  3228.                VOIDmode, 0);
  3229.     if (cleanups_this_call)
  3230.       {
  3231.         sorry ("aggreage value in COND_EXPR");
  3232.         cleanups_this_call = 0;
  3233.       }
  3234.  
  3235.     emit_queue ();
  3236.     emit_label (op1);
  3237.     OK_DEFER_POP;
  3238.     cleanups_this_call = old_cleanups;
  3239.     return temp;
  3240.       }
  3241.  
  3242.     case NEW_EXPR:
  3243.       {
  3244.     /* Something needs to be initialized, but we didn't know
  3245.        where that thing was when building the tree.  For example,
  3246.        it could be the return value of a function, or a parameter
  3247.        to a function which lays down in the stack, or a temporary
  3248.        variable which must be passed by reference.
  3249.  
  3250.        We guarantee that the expression will either be constructed
  3251.        or copied into our original target.  */
  3252.  
  3253.     tree slot = TREE_OPERAND (exp, 0);
  3254.  
  3255.     if (TREE_CODE (slot) != VAR_DECL)
  3256.       abort ();
  3257.  
  3258.     if (target == 0)
  3259.       {
  3260.         if (DECL_RTL (slot) != 0)
  3261.           target = DECL_RTL (slot);
  3262.         else
  3263.           {
  3264.         target = assign_stack_local (TYPE_MODE (type),
  3265.                          int_size_in_bytes (type));
  3266.         DECL_RTL (slot) = target;
  3267.           }
  3268.  
  3269. #if 0
  3270.         /* Since SLOT is not known to the called function
  3271.            to belong to its stack frame, we must build an explicit
  3272.            cleanup.  This case occurs when we must build up a reference
  3273.            to pass the reference as an argument.  In this case,
  3274.            it is very likely that such a reference need not be
  3275.            built here.  */
  3276.  
  3277.         if (TREE_OPERAND (exp, 2) == 0)
  3278.           TREE_OPERAND (exp, 2) = maybe_build_cleanup (slot);
  3279.         if (TREE_OPERAND (exp, 2))
  3280.           cleanups_this_call = tree_cons (0, TREE_OPERAND (exp, 2),
  3281.                          cleanups_this_call);
  3282. #endif
  3283.       }
  3284.     else
  3285.       {
  3286.         /* This case does occur, when expanding a parameter which
  3287.            needs to be constructed on the stack.  The target
  3288.            is the actual stack address that we want to initialize.
  3289.            The function we call will perform the cleanup in this case.  */
  3290.  
  3291.         DECL_RTL (slot) = target;
  3292.       }
  3293.  
  3294.     /* Run the initialization expression now with the target.  */
  3295.     return expand_expr (TREE_OPERAND (exp, 1), target, tmode, modifier);
  3296.       }
  3297.  
  3298.     case INIT_EXPR:
  3299.       {
  3300.     tree lhs = TREE_OPERAND (exp, 0);
  3301.     tree rhs = TREE_OPERAND (exp, 1);
  3302.     tree noncopied_parts = 0;
  3303.     tree lhs_type = TREE_TYPE (lhs);
  3304.  
  3305.     temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
  3306.     if (TYPE_NONCOPIED_PARTS (lhs_type) != 0 && !fixed_type_p (rhs))
  3307.       noncopied_parts = init_noncopied_parts (stabilize_reference (lhs),
  3308.                           TYPE_NONCOPIED_PARTS (lhs_type));
  3309.     while (noncopied_parts != 0)
  3310.       {
  3311.         expand_assignment (TREE_VALUE (noncopied_parts),
  3312.                    TREE_PURPOSE (noncopied_parts), 0, 0);
  3313.         noncopied_parts = TREE_CHAIN (noncopied_parts);
  3314.       }
  3315.     return temp;
  3316.       }
  3317.  
  3318.     case MODIFY_EXPR:
  3319.       {
  3320.     /* If lhs is complex, expand calls in rhs before computing it.
  3321.        That's so we don't compute a pointer and save it over a call.
  3322.        If lhs is simple, compute it first so we can give it as a
  3323.        target if the rhs is just a call.  This avoids an extra temp and copy
  3324.        and that prevents a partial-subsumption which makes bad code.
  3325.        Actually we could treat component_ref's of vars like vars.  */
  3326.  
  3327.     tree lhs = TREE_OPERAND (exp, 0);
  3328.     tree rhs = TREE_OPERAND (exp, 1);
  3329.     tree noncopied_parts = 0;
  3330.     tree lhs_type = TREE_TYPE (lhs);
  3331.  
  3332.     temp = 0;
  3333.  
  3334.     if (TREE_CODE (lhs) != VAR_DECL
  3335.         && TREE_CODE (lhs) != RESULT_DECL
  3336.         && TREE_CODE (lhs) != PARM_DECL)
  3337.       preexpand_calls (exp);
  3338.  
  3339.     /* Check for |= or &= of a bitfield of size one into another bitfield
  3340.        of size 1.  In this case, (unless we need the result of the
  3341.        assignment) we can do this more efficiently with a
  3342.        test followed by an assignment, if necessary.  */
  3343.     if (ignore
  3344.         && TREE_CODE (lhs) == COMPONENT_REF
  3345.         && (TREE_CODE (rhs) == BIT_IOR_EXPR
  3346.         || TREE_CODE (rhs) == BIT_AND_EXPR)
  3347.         && TREE_OPERAND (rhs, 0) == lhs
  3348.         && TREE_CODE (TREE_OPERAND (rhs, 1)) == COMPONENT_REF
  3349.         && (TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (lhs, 1)))
  3350.         * DECL_SIZE_UNIT (TREE_OPERAND (lhs, 1))) == 1
  3351.         && (TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (TREE_OPERAND (rhs, 1), 1)))
  3352.         * DECL_SIZE_UNIT (TREE_OPERAND (TREE_OPERAND (rhs, 1), 1))) == 1)
  3353.       {
  3354.         rtx label = gen_label_rtx ();
  3355.  
  3356.         do_jump (TREE_OPERAND (rhs, 1),
  3357.              TREE_CODE (rhs) == BIT_IOR_EXPR ? label : 0,
  3358.              TREE_CODE (rhs) == BIT_AND_EXPR ? label : 0);
  3359.         expand_assignment (lhs, convert (TREE_TYPE (rhs),
  3360.                          (TREE_CODE (rhs) == BIT_IOR_EXPR
  3361.                           ? integer_one_node
  3362.                           : integer_zero_node)),
  3363.                    0, 0);
  3364.         emit_label (label);
  3365.         return const0_rtx;
  3366.       }
  3367.  
  3368.     if (TYPE_NONCOPIED_PARTS (lhs_type) != 0
  3369.         && ! (fixed_type_p (lhs) && fixed_type_p (rhs)))
  3370.       noncopied_parts = save_noncopied_parts (stabilize_reference (lhs),
  3371.                           TYPE_NONCOPIED_PARTS (lhs_type));
  3372.  
  3373.     temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
  3374.     while (noncopied_parts != 0)
  3375.       {
  3376.         expand_assignment (TREE_PURPOSE (noncopied_parts),
  3377.                    TREE_VALUE (noncopied_parts), 0, 0);
  3378.         noncopied_parts = TREE_CHAIN (noncopied_parts);
  3379.       }
  3380.     return temp;
  3381.       }
  3382.  
  3383.     case PREINCREMENT_EXPR:
  3384.     case PREDECREMENT_EXPR:
  3385.       return expand_increment (exp, 0);
  3386.  
  3387.     case POSTINCREMENT_EXPR:
  3388.     case POSTDECREMENT_EXPR:
  3389.       /* Faster to treat as pre-increment if result is not used.  */
  3390.       return expand_increment (exp, ! ignore);
  3391.  
  3392.     case ADDR_EXPR:
  3393.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode,
  3394.              modifier != EXPAND_INTO_STACK ? EXPAND_CONST_ADDRESS : EXPAND_INTO_STACK);
  3395.       if (GET_CODE (op0) != MEM)
  3396.     abort ();
  3397.       if (modifier == EXPAND_SUM)
  3398.     return XEXP (op0, 0);
  3399.       op0 = force_operand (XEXP (op0, 0), target);
  3400.       if (flag_force_addr && GET_CODE (op0) != REG)
  3401.     return force_reg (Pmode, op0);
  3402.       return op0;
  3403.  
  3404.     case ENTRY_VALUE_EXPR:
  3405.       abort ();
  3406.  
  3407.     case ERROR_MARK:
  3408.       return const0_rtx;
  3409.  
  3410.     default:
  3411.       return (*lang_expand_expr) (exp, target, tmode, modifier);
  3412.     }
  3413.  
  3414.   /* Here to do an ordinary binary operator, generating an instruction
  3415.      from the optab already placed in `this_optab'.  */
  3416.  binop:
  3417.   /* Detect things like x = y | (a == b)
  3418.      and do them as (x = y), (a == b ? x |= 1 : 0), x.  */
  3419.   /* First, get the comparison or conditional into the second arg.  */
  3420.   if (comparison_code[(int) TREE_CODE (TREE_OPERAND (exp, 0))]
  3421.       || (TREE_CODE (TREE_OPERAND (exp, 0)) == COND_EXPR
  3422.       && (integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 1))
  3423.           || integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 2)))))
  3424.     {
  3425.       if (this_optab == ior_optab || this_optab == add_optab
  3426.       || this_optab == xor_optab)
  3427.     {
  3428.       tree exch = TREE_OPERAND (exp, 1);
  3429.       TREE_OPERAND (exp, 1) = TREE_OPERAND (exp, 0);
  3430.       TREE_OPERAND (exp, 0) = exch;
  3431.     }
  3432.     }
  3433.   /* Optimize X + (Y ? Z : 0) by computing X and maybe adding Z.  */
  3434.   if (comparison_code[(int) TREE_CODE (TREE_OPERAND (exp, 1))]
  3435.       || (TREE_CODE (TREE_OPERAND (exp, 1)) == COND_EXPR
  3436.       && (integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 1), 1))
  3437.           || integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 1), 2)))))
  3438.     {
  3439.       if (this_optab == ior_optab || this_optab == add_optab
  3440.       || this_optab == xor_optab || this_optab == sub_optab
  3441.       || this_optab == lshl_optab || this_optab == ashl_optab
  3442.       || this_optab == lshr_optab || this_optab == ashr_optab
  3443.       || this_optab == rotl_optab || this_optab == rotr_optab)
  3444.     {
  3445.       tree thenexp;
  3446.       rtx thenv = 0;
  3447.  
  3448.       /* TARGET gets a reg in which we can perform the computation.
  3449.          Use the specified target if it's a pseudo reg and safe.  */
  3450.       target = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  3451.       if (target == 0) target = gen_reg_rtx (mode);
  3452.  
  3453.       /* Compute X into the target.  */
  3454.       store_expr (TREE_OPERAND (exp, 0), target, 0);
  3455.       op0 = gen_label_rtx ();
  3456.  
  3457.       /* If other operand is a comparison COMP, treat it as COMP ? 1 : 0 */
  3458.       if (TREE_CODE (TREE_OPERAND (exp, 1)) != COND_EXPR)
  3459.         {
  3460.           do_jump (TREE_OPERAND (exp, 1), op0, 0);
  3461.           thenv = const1_rtx;
  3462.         }
  3463.       else if (integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 1), 2)))
  3464.         {
  3465.           do_jump (TREE_OPERAND (TREE_OPERAND (exp, 1), 0), op0, 0);
  3466.           thenexp = TREE_OPERAND (TREE_OPERAND (exp, 1), 1);
  3467.         }
  3468.       else
  3469.         {
  3470.           do_jump (TREE_OPERAND (TREE_OPERAND (exp, 1), 0), 0, op0);
  3471.           thenexp = TREE_OPERAND (TREE_OPERAND (exp, 1), 2);
  3472.         }
  3473.  
  3474.       if (thenv == 0)
  3475.         thenv = expand_expr (thenexp, 0, VOIDmode, 0);
  3476.  
  3477.       /* THENV is now Z, the value to operate on, as an rtx.
  3478.          We have already tested that Y isn't zero, so do the operation.  */
  3479.  
  3480.       if (this_optab == rotl_optab || this_optab == rotr_optab)
  3481.         temp = expand_binop (mode, this_optab, target, thenv, target,
  3482.                  -1, OPTAB_LIB);
  3483.       else if (this_optab == lshl_optab || this_optab == lshr_optab)
  3484.         temp = expand_binop (mode, this_optab, target, thenv, target,
  3485.                  1, OPTAB_LIB_WIDEN);
  3486.       else
  3487.         temp = expand_binop (mode, this_optab, target, thenv, target,
  3488.                  0, OPTAB_LIB_WIDEN);
  3489.       if (target != temp)
  3490.         emit_move_insn (target, temp);
  3491.  
  3492.       emit_queue ();
  3493.       do_pending_stack_adjust ();
  3494.       emit_label (op0);
  3495.       return target;
  3496.     }
  3497.     }
  3498.   subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  3499.   op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3500.   op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  3501.  binop2:
  3502.   temp = expand_binop (mode, this_optab, op0, op1, target,
  3503.                TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
  3504.   if (temp == 0)
  3505.     abort ();
  3506.   return temp;
  3507. }
  3508.  
  3509. /* Expand an expression EXP that calls a built-in function,
  3510.    with result going to TARGET if that's convenient
  3511.    (and in mode MODE if that's convenient).
  3512.    SUBTARGET may be used as the target for computing one of EXP's operands.
  3513.    IGNORE is nonzero if the value is to be ignored.  */
  3514.  
  3515. static rtx
  3516. expand_builtin (exp, target, subtarget, mode, ignore)
  3517.      tree exp;
  3518.      rtx target;
  3519.      rtx subtarget;
  3520.      enum machine_mode mode;
  3521.      int ignore;
  3522. {
  3523.   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
  3524.   tree arglist = TREE_OPERAND (exp, 1);
  3525.   rtx op0;
  3526.  
  3527.   switch (DECL_FUNCTION_CODE (fndecl))
  3528.     {
  3529.     case BUILT_IN_ABS:
  3530.     case BUILT_IN_LABS:
  3531.     case BUILT_IN_FABS:
  3532.       /* build_function_call changes these into ABS_EXPR.  */
  3533.       abort ();
  3534.  
  3535.     case BUILT_IN_SAVEREGS:
  3536.       {
  3537.     /* When this function is called, it means that registers must be
  3538.        saved on entry to this function.  So we migrate the
  3539.        call to the first insn of this function.  */
  3540.     rtx last = get_last_insn ();
  3541.     rtx temp, saving_insns, last_saving_insn;
  3542.  
  3543.     /* If there are parameters which must be saved from this function,
  3544.        save them now.  */
  3545.     saving_insns = save_from_saveregs;
  3546.     emit_insns (saving_insns);
  3547.     if (saving_insns)
  3548.       {
  3549.         emit_note (0, -1);
  3550.         last_saving_insn = get_last_insn ();
  3551.       }
  3552.  
  3553.     /* Now really call the function.  `expand_call' does not call
  3554.        expand_builtin, so there is no danger of infinite recursion here.  */
  3555.     temp = expand_call (exp, target, ignore);
  3556.  
  3557.     if (saving_insns)
  3558.       {
  3559.         do
  3560.           {
  3561.         if (GET_CODE (saving_insns) == INSN)
  3562.           note_stores (PATTERN (saving_insns), use_variable);
  3563.         saving_insns = NEXT_INSN (saving_insns);
  3564.           } while (saving_insns != last_saving_insn);
  3565.       }
  3566.     reorder_insns (NEXT_INSN (last), get_last_insn (), get_insns ());
  3567.     return temp;
  3568.       }
  3569.  
  3570.     case BUILT_IN_CLASSIFY_TYPE:
  3571.       if (arglist != 0)
  3572.     {
  3573.       tree type = TREE_TYPE (TREE_VALUE (arglist));
  3574.       enum tree_code code = TREE_CODE (type);
  3575.       if (code == VOID_TYPE)
  3576.         return gen_rtx (CONST_INT, VOIDmode, void_type_class);
  3577.       if (code == INTEGER_TYPE)
  3578.         return gen_rtx (CONST_INT, VOIDmode, integer_type_class);
  3579.       if (code == CHAR_TYPE)
  3580.         return gen_rtx (CONST_INT, VOIDmode, char_type_class);
  3581.       if (code == ENUMERAL_TYPE)
  3582.         return gen_rtx (CONST_INT, VOIDmode, enumeral_type_class);
  3583.       if (code == BOOLEAN_TYPE)
  3584.         return gen_rtx (CONST_INT, VOIDmode, boolean_type_class);
  3585.       if (code == POINTER_TYPE)
  3586.         return gen_rtx (CONST_INT, VOIDmode, pointer_type_class);
  3587.       if (code == REFERENCE_TYPE)
  3588.         return gen_rtx (CONST_INT, VOIDmode, reference_type_class);
  3589.       if (code == OFFSET_TYPE)
  3590.         return gen_rtx (CONST_INT, VOIDmode, offset_type_class);
  3591.       if (code == REAL_TYPE)
  3592.         return gen_rtx (CONST_INT, VOIDmode, real_type_class);
  3593.       if (code == COMPLEX_TYPE)
  3594.         return gen_rtx (CONST_INT, VOIDmode, complex_type_class);
  3595.       if (code == FUNCTION_TYPE)
  3596.         return gen_rtx (CONST_INT, VOIDmode, function_type_class);
  3597.       if (code == METHOD_TYPE)
  3598.         return gen_rtx (CONST_INT, VOIDmode, method_type_class);
  3599.       if (code == RECORD_TYPE)
  3600.         return gen_rtx (CONST_INT, VOIDmode, record_type_class);
  3601.       if (code == UNION_TYPE)
  3602.         return gen_rtx (CONST_INT, VOIDmode, union_type_class);
  3603.       if (code == ARRAY_TYPE)
  3604.         return gen_rtx (CONST_INT, VOIDmode, array_type_class);
  3605.       if (code == STRING_TYPE)
  3606.         return gen_rtx (CONST_INT, VOIDmode, string_type_class);
  3607.       if (code == SET_TYPE)
  3608.         return gen_rtx (CONST_INT, VOIDmode, set_type_class);
  3609.       if (code == FILE_TYPE)
  3610.         return gen_rtx (CONST_INT, VOIDmode, file_type_class);
  3611.       if (code == LANG_TYPE)
  3612.         return gen_rtx (CONST_INT, VOIDmode, lang_type_class);
  3613.     }
  3614.       return gen_rtx (CONST_INT, VOIDmode, no_type_class);
  3615.  
  3616.     case BUILT_IN_ALLOCA:
  3617.       if (arglist == 0
  3618.       /* Arg could be non-integer if user redeclared this fcn wrong.  */
  3619.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
  3620.     return const0_rtx;
  3621.       frame_pointer_needed = 1;
  3622.       current_function_calls_alloca = 1;
  3623.       /* Compute the argument.  */
  3624.       op0 = expand_expr (TREE_VALUE (arglist), 0, VOIDmode, 0);
  3625.       if (! CONSTANT_P (op0))
  3626.     {
  3627.       op0 = force_reg (GET_MODE (op0), op0);
  3628.       if (GET_MODE (op0) != Pmode)
  3629.         op0 = convert_to_mode (Pmode, op0, 1);
  3630.     }
  3631.       /* Push that much space (rounding it up).  */
  3632.       do_pending_stack_adjust ();
  3633.  
  3634. #ifdef STACK_POINTER_OFFSET
  3635.       /* If we will have to round the result down (which is up
  3636.      if stack grows down), make sure we have extra space so the
  3637.      user still gets at least as much space as he asked for.  */
  3638.       if ((STACK_POINTER_OFFSET + STACK_BYTES - 1) / STACK_BYTES
  3639.       != STACK_POINTER_OFFSET / STACK_BYTES)
  3640.     op0 = plus_constant (op0, STACK_BYTES);
  3641. #endif
  3642.  
  3643. #ifdef STACK_GROWS_DOWNWARD
  3644.       anti_adjust_stack (round_push (op0));
  3645. #endif
  3646.       /* Return a copy of current stack ptr, in TARGET if possible.  */
  3647.       if (target)
  3648.     emit_move_insn (target, stack_pointer_rtx);
  3649.       else
  3650.     target = copy_to_reg (stack_pointer_rtx);
  3651. #ifdef STACK_POINTER_OFFSET
  3652.       /* If the contents of the stack pointer reg are offset from the
  3653.      actual top-of-stack address, add the offset here.  */
  3654.       if (GET_CODE (target) == REG)
  3655.     emit_insn (gen_add2_insn (target,
  3656.                   gen_rtx (CONST_INT, VOIDmode,
  3657.                        (STACK_POINTER_OFFSET + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES)));
  3658.       else
  3659.     {
  3660.       rtx temp =
  3661.         expand_binop (GET_MODE (target), add_optab, target,
  3662.               gen_rtx (CONST_INT, VOIDmode,
  3663.                    (STACK_POINTER_OFFSET + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES),
  3664.               target,
  3665.               1, OPTAB_DIRECT);
  3666.       if (temp == 0) abort ();
  3667.       if (temp != target)
  3668.         emit_move_insn (target, temp);
  3669.     }
  3670. #endif
  3671. #ifndef STACK_GROWS_DOWNWARD
  3672.       anti_adjust_stack (round_push (op0));
  3673. #endif
  3674.       /* Some systems require a particular insn to refer to the stack
  3675.      to make the pages exist.  */
  3676. #ifdef HAVE_probe
  3677.       if (HAVE_probe)
  3678.     emit_insn (gen_probe ());
  3679. #endif
  3680.       return target;
  3681.  
  3682.     case BUILT_IN_FFS:
  3683.       if (arglist == 0
  3684.       /* Arg could be non-integer if user redeclared this fcn wrong.  */
  3685.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
  3686.     return const0_rtx;
  3687.  
  3688.       /* Compute the argument.  */
  3689.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);
  3690.       /* Compute ffs, into TARGET if possible.
  3691.      Set TARGET to wherever the result comes back.  */
  3692.       target = expand_unop (mode, ffs_optab, op0, target, 1);
  3693.       if (target == 0)
  3694.     abort ();
  3695.       return target;
  3696.  
  3697.     default:
  3698.       abort ();
  3699.     }
  3700. }
  3701.  
  3702. /* Expand code for a post- or pre- increment or decrement
  3703.    and return the RTX for the result.
  3704.    POST is 1 for postinc/decrements and 0 for preinc/decrements.  */
  3705.  
  3706. static rtx
  3707. expand_increment (exp, post)
  3708.      register tree exp;
  3709.      int post;
  3710. {
  3711.   register rtx op0, op1;
  3712.   register rtx temp;
  3713.   register tree incremented = TREE_OPERAND (exp, 0);
  3714.   optab this_optab = add_optab;
  3715.   int icode;
  3716.   enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
  3717.   int op0_is_copy = 0;
  3718.  
  3719.   /* Stabilize any component ref that might need to be
  3720.      evaluated more than once below.  */
  3721.   if (TREE_CODE (incremented) == COMPONENT_REF
  3722.       && (TREE_CODE (TREE_OPERAND (incremented, 0)) != INDIRECT_REF
  3723.       || DECL_MODE (TREE_OPERAND (incremented, 1)) == BImode))
  3724.     incremented = stabilize_reference (incremented);
  3725.  
  3726.   /* Compute the operands as RTX.
  3727.      Note whether OP0 is the actual lvalue or a copy of it:
  3728.      I believe it is a copy iff it is a register and insns were
  3729.      generated in computing it.  */
  3730.   temp = get_last_insn ();
  3731.   op0 = expand_expr (incremented, 0, VOIDmode, 0);
  3732.   if (temp != get_last_insn ())
  3733.     op0_is_copy = (GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG);
  3734.   op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  3735.  
  3736.   /* Decide whether incrementing or decrementing.  */
  3737.   if (TREE_CODE (exp) == POSTDECREMENT_EXPR
  3738.       || TREE_CODE (exp) == PREDECREMENT_EXPR)
  3739.     this_optab = sub_optab;
  3740.  
  3741.   /* If OP0 is not the actual lvalue, but rather a copy in a register,
  3742.      then we cannot just increment OP0.  We must
  3743.      therefore contrive to increment the original value.
  3744.      Then we can return OP0 since it is a copy of the old value.  */
  3745.   if (op0_is_copy)
  3746.     {
  3747.       /* This is the easiest way to increment the value wherever it is.
  3748.      Problems with multiple evaluation of INCREMENTED
  3749.      are prevented because either (1) it is a component_ref,
  3750.      in which case it was stabilized above, or (2) it is an array_ref
  3751.      with constant index in an array in a register, which is
  3752.      safe to reevaluate.  */
  3753.       tree newexp = build ((this_optab == add_optab
  3754.                 ? PLUS_EXPR : MINUS_EXPR),
  3755.                TREE_TYPE (exp),
  3756.                incremented,
  3757.                TREE_OPERAND (exp, 1));
  3758.       temp = expand_assignment (incremented, newexp, ! post, 0);
  3759.       return post ? op0 : temp;
  3760.     }
  3761.  
  3762.   /* Convert decrement by a constant into a negative increment.  */
  3763.   if (this_optab == sub_optab
  3764.       && GET_CODE (op1) == CONST_INT)
  3765.     {
  3766.       op1 = gen_rtx (CONST_INT, VOIDmode, - INTVAL (op1));
  3767.       this_optab = add_optab;
  3768.     }
  3769.  
  3770.   if (post)
  3771.     {
  3772.       /* We have a true reference to the value in OP0.
  3773.      If there is an insn to add or subtract in this mode, queue it.  */
  3774.  
  3775.       /* I'm not sure this is still necessary.  */
  3776.       op0 = stabilize (op0);
  3777.  
  3778.       icode = (int) this_optab->handlers[(int) mode].insn_code;
  3779.       if (icode != (int) CODE_FOR_nothing
  3780.       /* Make sure that OP0 is valid for operands 0 and 1
  3781.          of the insn we want to queue.  */
  3782.       && (*insn_operand_predicate[icode][0]) (op0, mode)
  3783.       && (*insn_operand_predicate[icode][1]) (op0, mode))
  3784.     {
  3785.       if (! (*insn_operand_predicate[icode][2]) (op1, mode))
  3786.         op1 = force_reg (mode, op1);
  3787.  
  3788.       return enqueue_insn (op0, GEN_FCN (icode) (op0, op0, op1));
  3789.     }
  3790.     }
  3791.  
  3792.   /* Preincrement, or we can't increment with one simple insn.  */
  3793.   if (post)
  3794.     /* Save a copy of the value before inc or dec, to return it later.  */
  3795.     temp = copy_to_reg (op0);
  3796.   else
  3797.     /* Arrange to return the incremented value.  */
  3798.     /* Copy the rtx because expand_binop will protect from the queue,
  3799.        and the results of that would be invalid for us to return
  3800.        if our caller does emit_queue before using our result.  */
  3801.     temp = copy_rtx (op0);
  3802.  
  3803.   /* Increment however we can.  */
  3804.   op1 = expand_binop (mode, this_optab, op0, op1, op0,
  3805.               TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
  3806.   /* Make sure the value is stored into OP0.  */
  3807.   if (op1 != op0)
  3808.     emit_move_insn (op0, op1);
  3809.  
  3810.   return temp;
  3811. }
  3812.  
  3813. /* Expand all function calls contained within EXP, innermost ones first.
  3814.    But don't look within expressions that have sequence points.
  3815.    For each CALL_EXPR, record the rtx for its value
  3816.    in the CALL_EXPR_RTL field.
  3817.  
  3818.    Calls that return large structures for which a structure return
  3819.    stack slot is needed are not preexpanded.  Preexpanding them loses
  3820.    because if more than one were preexpanded they would try to use the
  3821.    same stack slot.  */
  3822.  
  3823. static void
  3824. preexpand_calls (exp)
  3825.      tree exp;
  3826. {
  3827.   register int nops, i;
  3828.  
  3829.   if (! do_preexpand_calls)
  3830.     return;
  3831.  
  3832.   /* Only expressions and references can contain calls.  */
  3833.  
  3834.   if (tree_code_type[(int) TREE_CODE (exp)][0] != 'e'
  3835.       && tree_code_type[(int) TREE_CODE (exp)][0] != 'r')
  3836.     return;
  3837.  
  3838.   switch (TREE_CODE (exp))
  3839.     {
  3840.     case CALL_EXPR:
  3841.       /* Do nothing to built-in functions.  */
  3842.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
  3843.       && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == FUNCTION_DECL
  3844.       && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
  3845.           != NOT_BUILT_IN))
  3846.     return;
  3847.       /* Precompute calls that don't return values in memory.  */
  3848.       if (CALL_EXPR_RTL (exp) == 0
  3849.       && TYPE_MODE (TREE_TYPE (exp)) != BLKmode
  3850.       && ! RETURN_IN_MEMORY (TREE_TYPE (exp)))
  3851.     CALL_EXPR_RTL (exp) = expand_call (exp, 0, 0, 0);
  3852.       return;
  3853.  
  3854.     case COMPOUND_EXPR:
  3855.     case COND_EXPR:
  3856.     case TRUTH_ANDIF_EXPR:
  3857.     case TRUTH_ORIF_EXPR:
  3858.       /* If we find one of these, then we can be sure
  3859.      the adjust will be done for it (since it makes jumps).
  3860.      Do it now, so that if this is inside an argument
  3861.      of a function, we don't get the stack adjustment
  3862.      after some other args have already been pushed.  */
  3863.       do_pending_stack_adjust ();
  3864.       return;
  3865.  
  3866.     case RTL_EXPR:
  3867.     case WITH_CLEANUP_EXPR:
  3868.       return;
  3869.  
  3870.     case SAVE_EXPR:
  3871.       if (SAVE_EXPR_RTL (exp) != 0)
  3872.     return;
  3873.     }
  3874.  
  3875.   nops = tree_code_length[(int) TREE_CODE (exp)];
  3876.   for (i = 0; i < nops; i++)
  3877.     if (TREE_OPERAND (exp, i) != 0)
  3878.       {
  3879.     register int type = *tree_code_type[(int) TREE_CODE (TREE_OPERAND (exp, i))];
  3880.     if (type == 'e' || type == 'r')
  3881.       preexpand_calls (TREE_OPERAND (exp, i));
  3882.       }
  3883. }
  3884.  
  3885. /* Force FUNEXP into a form suitable for the address of a CALL,
  3886.    and return that as an rtx.  Also load the static chain register
  3887.    from either FUNEXP or CONTEXT.  */
  3888.  
  3889. static rtx
  3890. prepare_call_address (funexp, context)
  3891.      rtx funexp;
  3892.      rtx context;
  3893. {
  3894.   funexp = protect_from_queue (funexp, 0);
  3895.   if (context != 0)
  3896.     context = protect_from_queue (context, 0);
  3897.  
  3898.   /* Function variable in language with nested functions.  */
  3899.   if (GET_MODE (funexp) == EPmode)
  3900.     {
  3901.       emit_move_insn (static_chain_rtx, gen_highpart (Pmode, funexp));
  3902.       funexp = memory_address (FUNCTION_MODE, gen_lowpart (Pmode, funexp));
  3903.       emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
  3904.     }
  3905.   else
  3906.     {
  3907.       if (context != 0)
  3908.     /* Unless function variable in C, or top level function constant */
  3909.     emit_move_insn (static_chain_rtx, lookup_static_chain (context));
  3910.  
  3911.       /* Make a valid memory address and copy constants thru pseudo-regs,
  3912.      but not for a constant address if -fno-function-cse.  */
  3913.       if (GET_CODE (funexp) != SYMBOL_REF)
  3914.     funexp = memory_address (FUNCTION_MODE, funexp);
  3915.       else
  3916.     {
  3917. #ifndef NO_FUNCTION_CSE
  3918.       if (optimize && ! flag_no_function_cse)
  3919.         funexp = force_reg (Pmode, funexp);
  3920. #endif
  3921.     }
  3922.  
  3923.       if (context != 0)
  3924.     emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
  3925.     }
  3926.   return funexp;
  3927. }
  3928.  
  3929. /* Generate instructions to call function FUNEXP,
  3930.    and optionally pop the results.
  3931.    The CALL_INSN is the first insn generated.
  3932.  
  3933.    FUNTYPE is the data type of the function, or, for a library call,
  3934.    the identifier for the name of the call.  This is given to the
  3935.    macro RETURN_POPS_ARGS to determine whether this function pops its own args.
  3936.  
  3937.    STACK_SIZE is the number of bytes of arguments on the stack,
  3938.    rounded up to STACK_BOUNDARY; zero if the size is variable.
  3939.    This is both to put into the call insn and
  3940.    to generate explicit popping code if necessary.
  3941.  
  3942.    NEXT_ARG_REG is the rtx that results from executing
  3943.      FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1)
  3944.    just after all the args have had their registers assigned.
  3945.    This could be whatever you like, but normally it is the first
  3946.    arg-register beyond those used for args in this call,
  3947.    or 0 if all the arg-registers are used in this call.
  3948.    It is passed on to `gen_call' so you can put this info in the call insn.
  3949.  
  3950.    VALREG is a hard register in which a value is returned,
  3951.    or 0 if the call does not return a value.
  3952.  
  3953.    OLD_INHIBIT_DEFER_POP is the value that `inhibit_defer_pop' had before
  3954.    the args to this call were processed.
  3955.    We restore `inhibit_defer_pop' to that value.
  3956.  
  3957.    USE_INSNS is a SEQUENCE of USE insns to be emitted immediately before
  3958.    the actual CALL insn.  */
  3959.  
  3960. static void
  3961. emit_call_1 (funexp, funtype, stack_size, next_arg_reg, valreg, old_inhibit_defer_pop, use_insns)
  3962.      rtx funexp;
  3963.      tree funtype;
  3964.      int stack_size;
  3965.      rtx next_arg_reg;
  3966.      rtx valreg;
  3967.      int old_inhibit_defer_pop;
  3968.      rtx use_insns;
  3969. {
  3970.   rtx stack_size_rtx = gen_rtx (CONST_INT, VOIDmode, stack_size);
  3971.   rtx call_insn;
  3972.  
  3973.   if (valreg)
  3974.     emit_call_insn (gen_call_value (valreg,
  3975.                     gen_rtx (MEM, FUNCTION_MODE, funexp),
  3976.                     stack_size_rtx, next_arg_reg));
  3977.   else
  3978.     emit_call_insn (gen_call (gen_rtx (MEM, FUNCTION_MODE, funexp),
  3979.                   stack_size_rtx, next_arg_reg));
  3980.  
  3981.   /* Find the CALL insn we just emitted and write the USE insns before it.  */
  3982.   for (call_insn = get_last_insn();
  3983.        call_insn && GET_CODE (call_insn) != CALL_INSN;
  3984.        call_insn = PREV_INSN (call_insn))
  3985.     ;
  3986.  
  3987.   if (! call_insn)
  3988.     abort ();
  3989.  
  3990.   /* Put the USE insns before the CALL.  */
  3991.   emit_insn_before (use_insns, call_insn);
  3992.  
  3993.   inhibit_defer_pop = old_inhibit_defer_pop;
  3994.  
  3995.   /* If returning from the subroutine does not automatically pop the args,
  3996.      we need an instruction to pop them sooner or later.
  3997.      Perhaps do it now; perhaps just record how much space to pop later.  */
  3998.  
  3999.   if (! RETURN_POPS_ARGS (TREE_TYPE (funtype))
  4000.       && stack_size != 0)
  4001.     {
  4002.       if (flag_defer_pop && inhibit_defer_pop == 0)
  4003.     pending_stack_adjust += stack_size;
  4004.       else
  4005.     adjust_stack (stack_size_rtx);
  4006.     }
  4007. }
  4008.  
  4009. /* At the start of a function, record that we have no previously-pushed
  4010.    arguments waiting to be popped.  */
  4011.  
  4012. void
  4013. init_pending_stack_adjust ()
  4014. {
  4015.   pending_stack_adjust = 0;
  4016. }
  4017.  
  4018. /* When exiting from function, if safe, clear out any pending stack adjust
  4019.    so the adjustment won't get done.  */
  4020.  
  4021. void
  4022. clear_pending_stack_adjust ()
  4023. {
  4024. #ifdef EXIT_IGNORE_STACK
  4025.   if (!flag_omit_frame_pointer && EXIT_IGNORE_STACK
  4026.       && ! TREE_INLINE (current_function_decl)
  4027.       && ! flag_inline_functions)
  4028.     pending_stack_adjust = 0;
  4029. #endif
  4030. }
  4031.  
  4032. /* Pop any previously-pushed arguments that have not been popped yet.  */
  4033.  
  4034. void
  4035. do_pending_stack_adjust ()
  4036. {
  4037.   if (inhibit_defer_pop == 0)
  4038.     {
  4039.       if (pending_stack_adjust != 0)
  4040.     adjust_stack (gen_rtx (CONST_INT, VOIDmode, pending_stack_adjust));
  4041.       pending_stack_adjust = 0;
  4042.     }
  4043. }
  4044.  
  4045. /* Expand all cleanups up to OLD_CLEANUPS.
  4046.    Needed here, and also for language-dependent calls.  */
  4047. void
  4048. expand_cleanups_to (old_cleanups)
  4049.      tree old_cleanups;
  4050. {
  4051.   while (cleanups_this_call != old_cleanups)
  4052.     {
  4053.       expand_expr (TREE_VALUE (cleanups_this_call), 0, VOIDmode, 0);
  4054.       cleanups_this_call = TREE_CHAIN (cleanups_this_call);
  4055.     }
  4056. }
  4057.  
  4058. /* Data structure and subroutines used within expand_call.  */
  4059.  
  4060. struct arg_data
  4061. {
  4062.   /* Tree node for this argument.  */
  4063.   tree tree_value;
  4064.   /* Precomputed RTL value, or 0 if it isn't precomputed.  */
  4065.   rtx value;
  4066.   /* Register to pass this argument in, or 0 if passed on stack.  */
  4067.   rtx reg;
  4068.   /* Number of registers to use.  0 means put the whole arg in registers.
  4069.      Also 0 if not passed in registers.  */
  4070.   int partial;
  4071.   /* Offset of this argument from beginning of stack-args.  */
  4072.   struct args_size offset;
  4073.   /* Size of this argument on the stack, rounded up for any padding it gets,
  4074.      parts of the argument passed in registers do not count.
  4075.      If the FIRST_PARM_CALLER_OFFSET is negative, then register parms
  4076.      are counted here as well.  */
  4077.   struct args_size size;
  4078.   /* Nonzero if this arg has already been stored.  */
  4079.   int stored;
  4080.   /* const0_rtx means should preallocate stack space for this arg.
  4081.      Other non0 value is the stack slot, preallocated.
  4082.      Used only for BLKmode.  */
  4083.   rtx stack;
  4084. };
  4085.  
  4086. static void store_one_arg ();
  4087. static rtx target_for_arg ();
  4088.  
  4089. /* Generate all the code for a function call
  4090.    and return an rtx for its value.
  4091.    Store the value in TARGET (specified as an rtx) if convenient.
  4092.    If the value is stored in TARGET then TARGET is returned.
  4093.    If IGNORE is nonzero, then we ignore the value of the function call.  */
  4094.  
  4095. static rtx
  4096. expand_call (exp, target, ignore, modifier)
  4097.      tree exp;
  4098.      rtx target;
  4099.      int ignore;
  4100.      enum expand_modifier modifier;
  4101. {
  4102.   /* List of actual parameters.  */
  4103.   tree actparms = TREE_OPERAND (exp, 1);
  4104.   /* RTX for the function to be called.  */
  4105.   rtx funexp;
  4106.   /* Data type of the function.  */
  4107.   tree funtype;
  4108.   /* Declaration of the function being called,
  4109.      or 0 if the function is computed (not known by name).  */
  4110.   tree fndecl = 0;
  4111.   char *name = 0;
  4112.  
  4113.   /* Register in which non-BLKmode value will be returned,
  4114.      or 0 if no value or if value is BLKmode.  */
  4115.   rtx valreg;
  4116.   /* Address where we should return a BLKmode value;
  4117.      0 if value not BLKmode.  */
  4118.   rtx structure_value_addr = 0;
  4119.   /* Nonzero if that address is being passed by treating it as
  4120.      an extra, implicit first parameter.  Otherwise,
  4121.      it is passed by being copied directly into struct_value_rtx.  */
  4122.   int structure_value_addr_parm = 0;
  4123.   /* Nonzero if called function returns an aggregate in memory PCC style,
  4124.      by returning the address of where to find it.  */
  4125.   int pcc_struct_value = 0;
  4126.  
  4127.   /* Number of actual parameters in this call, including struct value addr.  */
  4128.   int num_actuals;
  4129.   /* Number of named args.  Args after this are anonymous ones
  4130.      and they must all go on the stack.  */
  4131.   int n_named_args;
  4132.  
  4133.   /* Vector of information about each argument.
  4134.      Arguments are numbered in the order they will be pushed,
  4135.      not the order they are written.  */
  4136.   struct arg_data *args;
  4137.  
  4138.   /* Total size in bytes of all the stack-parms scanned so far.  */
  4139.   struct args_size args_size;
  4140.   /* Remember initial value of args_size.constant.  */
  4141.   int starting_args_size;
  4142.   /* Nonzero means count reg-parms' size in ARGS_SIZE.  */
  4143.   int stack_count_regparms = 0;
  4144.   /* Data on reg parms scanned so far.  */
  4145.   CUMULATIVE_ARGS args_so_far;
  4146.   /* Nonzero if a reg parm has been scanned.  */
  4147.   int reg_parm_seen;
  4148.   /* Nonzero if we must avoid push-insns in the args for this call.  */
  4149.   int must_preallocate;
  4150.   /* 1 if scanning parms front to back, -1 if scanning back to front.  */
  4151.   int inc;
  4152.   /* Address of space preallocated for stack parms
  4153.      (on machines that lack push insns), or 0 if space not preallocated.  */
  4154.   rtx argblock = 0;
  4155.  
  4156.   /* Nonzero if it is plausible that this is a call to alloca.  */
  4157.   int may_be_alloca;
  4158.   /* Nonzero if this is a call to setjmp or a related function.  */
  4159.   int is_setjmp;
  4160.   /* Nonzero if this is a call to longjmp or a related function.  */
  4161.   int is_longjmp;
  4162.   /* Nonzero if this is a call to an inline function.  */
  4163.   int is_integrable = 0;
  4164.   /* Nonzero if this is a call to __builtin_new.  */
  4165.   int is_builtin_new;
  4166.   /* Nonzero if this is a call to a `const' function.  */
  4167.   int is_const = 0;
  4168.  
  4169.   /* Nonzero if there are BLKmode args whose data types require them
  4170.      to be passed in memory, not (even partially) in registers.  */
  4171.   int BLKmode_parms_forced = 0;
  4172.   /* The offset of the first BLKmode parameter which 
  4173.      *must* be passed in memory.  */
  4174.   int BLKmode_parms_first_offset = 0;
  4175.   /* Total size of BLKmode parms which could usefully be preallocated.  */
  4176.   int BLKmode_parms_sizes = 0;
  4177.  
  4178.   /* Amount stack was adjusted to protect BLKmode parameters
  4179.      which are below the nominal "stack address" value.  */
  4180.   rtx protected_stack = 0;
  4181.  
  4182.   /* The last insn before the things that are intrinsically part of the call.
  4183.      The beginning reg-note goes on the insn after this one.  */
  4184.   rtx insn_before;
  4185.  
  4186.   rtx old_stack_level = 0;
  4187.   int old_pending_adj;
  4188.   int old_inhibit_defer_pop = inhibit_defer_pop;
  4189.   tree old_cleanups = cleanups_this_call;
  4190.   rtx use_insns;
  4191.  
  4192.   register tree p;
  4193.   register int i;
  4194.  
  4195.   /* See if we can find a DECL-node for the actual function.
  4196.      As a result, decide whether this is a call to an integrable function.  */
  4197.  
  4198.   p = TREE_OPERAND (exp, 0);
  4199.   if (TREE_CODE (p) == ADDR_EXPR)
  4200.     {
  4201.       fndecl = TREE_OPERAND (p, 0);
  4202.       if (TREE_CODE (fndecl) != FUNCTION_DECL)
  4203.     {
  4204.       /* May still be a `const' function if it is
  4205.          a call through a const function.  */
  4206.       fndecl = 0;
  4207.     }
  4208.       else
  4209.     {
  4210.       extern tree current_function_decl;
  4211.       extern int flag_no_inline;
  4212.  
  4213.       if (!flag_no_inline
  4214.           && fndecl != current_function_decl
  4215.           && DECL_SAVED_INSNS (fndecl))
  4216.         is_integrable = 1;
  4217.       else if (! TREE_ADDRESSABLE (fndecl))
  4218.         {
  4219.           /* In case this function later becomes inlineable,
  4220.          record that there was already a non-inline call to it.
  4221.  
  4222.          Use abstraction instead of setting TREE_ADDRESSABLE
  4223.          directly.  */
  4224.           if (TREE_INLINE (fndecl) && extra_warnings)
  4225.         warning_with_decl (fndecl, "can't inline call to `%s' which was declared inline");
  4226.           mark_addressable (fndecl);
  4227.         }
  4228.  
  4229.       if (TREE_READONLY (fndecl) && ! TREE_THIS_VOLATILE (fndecl))
  4230.         is_const = 1;
  4231.     }
  4232.     }
  4233.  
  4234.   /* When calling a const function, we must pop the stack args right away,
  4235.      so that the pop is deleted or moved with the call.  */
  4236.   if (is_const)
  4237.     NO_DEFER_POP;
  4238.  
  4239.   /* Set up a place to return a structure.  */
  4240.  
  4241.   /* Cater to broken compilers.  */
  4242.   if (aggregate_value_p (exp))
  4243.     {
  4244.       /* This call returns a big structure.  */
  4245. #ifdef PCC_STATIC_STRUCT_RETURN
  4246.       if (flag_pcc_struct_return)
  4247.     {
  4248.       pcc_struct_value = 1;
  4249.       is_integrable = 0;  /* Easier than making that case work right.  */
  4250.     }
  4251.       else
  4252. #endif
  4253.     {
  4254.       if (target && GET_CODE (target) == MEM)
  4255.         {
  4256.           structure_value_addr = XEXP (target, 0);
  4257.           if (reg_mentioned_p (stack_pointer_rtx, structure_value_addr))
  4258.         structure_value_addr = copy_to_reg (structure_value_addr);
  4259.         }
  4260.       else
  4261.         {
  4262.           /* Make room on the stack to hold the value.  */
  4263.           structure_value_addr
  4264.         = get_structure_value_addr (expr_size (exp));
  4265.           target = 0;
  4266.         }
  4267.     }
  4268.     }
  4269.  
  4270.   /* If called function is inline, try to integrate it.  */
  4271.  
  4272.   if (is_integrable)
  4273.     {
  4274.       extern rtx expand_inline_function ();
  4275.       rtx temp;
  4276.  
  4277.       temp = expand_inline_function (fndecl, actparms, target,
  4278.                      ignore, TREE_TYPE (exp),
  4279.                      structure_value_addr);
  4280.  
  4281.       /* If inlining succeeded, return.  */
  4282.       if ((int) temp != -1)
  4283.     {
  4284.       /* Perform all cleanups needed for the arguments of this call
  4285.          (i.e. destructors in C++).  It is ok if these destructors
  4286.          clobber RETURN_VALUE_REG, because the only time we care about
  4287.          this is when TARGET is that register.  But in C++, we take
  4288.          care to never return that register directly.  */
  4289.       expand_cleanups_to (old_cleanups);
  4290.       return temp;
  4291.     }
  4292.  
  4293.       /* If inlining failed, mark FNDECL as needing to be compiled
  4294.      separately after all.  */
  4295.       mark_addressable (fndecl);
  4296.     }
  4297.  
  4298.   if (fndecl)
  4299.     name = IDENTIFIER_POINTER (DECL_NAME (fndecl));
  4300.  
  4301. #if 0
  4302.   /* Unless it's a call to a specific function that isn't alloca,
  4303.      if it has one argument, we must assume it might be alloca.  */
  4304.  
  4305.   may_be_alloca =
  4306.     (!(fndecl != 0 && strcmp (name, "alloca"))
  4307.      && actparms != 0
  4308.      && TREE_CHAIN (actparms) == 0);
  4309. #else
  4310.   /* We assume that alloca will always be called by name.  It
  4311.      makes no sense to pass it as a pointer-to-function to
  4312.      anything that does not understand its behavior.  */
  4313.   may_be_alloca =
  4314.     (fndecl && ((IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 6
  4315.          && name[0] == 'a'
  4316.          && ! strcmp (name, "alloca"))
  4317.         || (IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 16
  4318.             && name[0] == '_'
  4319.             && ! strcmp (name, "__builtin_alloca"))));
  4320. #endif
  4321.  
  4322.   /* See if this is a call to a function that can return more than once.  */
  4323.   if (fndecl == 0
  4324.       || IDENTIFIER_LENGTH (DECL_NAME (fndecl)) > 15)
  4325.     is_setjmp = 0;
  4326.   else
  4327.     {
  4328.       char *tname = name + (name[0] == '_');
  4329.  
  4330.       if (tname[0] == 's')
  4331.     {
  4332.       is_setjmp
  4333.         = ((tname[1] == 'e'
  4334.         && (!strcmp (tname, "setjmp")
  4335.             || !strcmp (tname, "setjmp_syscall")))
  4336.            || (tname[1] == 'i'
  4337.            && !strcmp (tname, "sigsetjmp"))
  4338.            || (tname[1] == 'a'
  4339.            && !strcmp (tname, "savectx")));
  4340.     }
  4341.       else if (tname[0] == 'q' && tname[1] == 's')
  4342.     {
  4343.       is_setjmp = !strcmp (tname+1, "setjmp");
  4344.     }
  4345.       else
  4346.     is_setjmp = 0;
  4347.     }
  4348.  
  4349.   if (fndecl && strcmp (name, "longjmp") == 0)
  4350.     is_longjmp = 1;
  4351.   else
  4352.     is_longjmp = 0;
  4353.  
  4354.   is_builtin_new
  4355.     = (fndecl != 0
  4356.        && IDENTIFIER_LENGTH (DECL_NAME (fndecl)) == 13
  4357.        && (!strcmp (name, "__builtin_new")));
  4358.  
  4359.   if (may_be_alloca)
  4360.     {
  4361.       frame_pointer_needed = 1;
  4362.       may_call_alloca = 1;
  4363.       current_function_calls_alloca = 1;
  4364.     }
  4365.  
  4366.   /* Don't let pending stack adjusts add up to too much.
  4367.      Also, do all pending adjustments now
  4368.      if there is any chance this might be a call to alloca (or longjmp).  */
  4369.  
  4370.   if (pending_stack_adjust >= 32
  4371.       || (pending_stack_adjust > 0 && (may_be_alloca || is_setjmp || is_longjmp)))
  4372.     do_pending_stack_adjust ();
  4373.  
  4374.   /* Operand 0 is a pointer-to-function; get the type of the function.  */
  4375.   funtype = TREE_TYPE (TREE_OPERAND (exp, 0));
  4376.   if (TREE_CODE (funtype) != POINTER_TYPE)
  4377.     abort ();
  4378.   funtype = TREE_TYPE (funtype);
  4379.  
  4380.   /* If struct_value_rtx is 0, it means pass the address
  4381.      as if it were an extra parameter.  */
  4382.   if (structure_value_addr && struct_value_rtx == 0)
  4383.     {
  4384.       rtx tem;
  4385.  
  4386.       INIT_CUMULATIVE_ARGS (args_so_far, funtype);
  4387.       tem = FUNCTION_ARG (args_so_far, Pmode,
  4388.               build_pointer_type (TREE_TYPE (funtype)), 1);
  4389.       if (tem == 0)
  4390.     {
  4391.       actparms = tree_cons (error_mark_node,
  4392.                 build (SAVE_EXPR,
  4393.                        type_for_size (GET_MODE_BITSIZE (Pmode), 0),
  4394.                        0,
  4395.                        force_reg (Pmode, structure_value_addr)),
  4396.                 actparms);
  4397.       structure_value_addr_parm = 1;
  4398.     }
  4399.     }
  4400.  
  4401.   /* Count the arguments and set NUM_ACTUALS.  */
  4402.   for (p = actparms, i = 0; p; p = TREE_CHAIN (p)) i++;
  4403.   num_actuals = i;
  4404.  
  4405.   /* Compute number of named args.
  4406.      Don't include the last named arg if anonymous args follow.
  4407.      (If no anonymous args follow, the result of list_length
  4408.      is actually one too large.)  */
  4409.   if (TYPE_ARG_TYPES (funtype) != 0)
  4410.     n_named_args = list_length (TYPE_ARG_TYPES (funtype)) - 1;
  4411.   else
  4412.     /* If we know nothing, treat all args as named.  */
  4413.     n_named_args = num_actuals;
  4414.  
  4415.   /* Make a vector to hold all the information about each arg.  */
  4416.   args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data));
  4417.   bzero (args, num_actuals * sizeof (struct arg_data));
  4418.  
  4419.   args_size.constant = 0;
  4420.   args_size.var = 0;
  4421. #ifdef FIRST_PARM_CALLER_OFFSET
  4422.   args_size.constant = FIRST_PARM_CALLER_OFFSET (funtype);
  4423.   stack_count_regparms = 1;
  4424. #endif
  4425.   starting_args_size = args_size.constant;
  4426.  
  4427.   /* In this loop, we consider args in the order they are written.
  4428.      We fill up ARGS from the front of from the back if necessary
  4429.      so that in any case the first arg to be pushed ends up at the front.  */
  4430.  
  4431. #ifdef PUSH_ARGS_REVERSED
  4432.   i = num_actuals - 1, inc = -1;
  4433.   /* In this case, must reverse order of args
  4434.      so that we compute and push the last arg first.  */
  4435. #else
  4436.   i = 0, inc = 1;
  4437. #endif
  4438.  
  4439.   INIT_CUMULATIVE_ARGS (args_so_far, funtype);
  4440.  
  4441.   for (p = actparms; p; p = TREE_CHAIN (p), i += inc)
  4442.     {
  4443.       tree type = TREE_TYPE (TREE_VALUE (p));
  4444.       args[i].tree_value = TREE_VALUE (p);
  4445.       args[i].offset = args_size;
  4446.  
  4447.       if (type == error_mark_node
  4448.       || TYPE_SIZE (type) == 0)
  4449.     continue;
  4450.  
  4451.       /* Decide where to pass this arg.  */
  4452.       /* args[i].reg is nonzero if all or part is passed in registers.
  4453.      args[i].partial is nonzero if part but not all is passed in registers,
  4454.       and the exact value says how many words are passed in registers.  */
  4455.  
  4456.       if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
  4457.       && args_size.var == 0
  4458.       /* error_mark_node here is a flag for the fake argument
  4459.          for a structure value address.  */
  4460.       && TREE_PURPOSE (p) != error_mark_node)
  4461.     {
  4462.       args[i].reg = FUNCTION_ARG (args_so_far, TYPE_MODE (type), type,
  4463.                       i < n_named_args);
  4464.       /* If this argument needs more than the usual parm alignment, do
  4465.          extrinsic padding to reach that alignment.  */
  4466.  
  4467. #ifdef MAX_PARM_BOUNDARY
  4468.       /* If MAX_PARM_BOUNDARY is not defined, it means that the usual
  4469.          alignment requirements are relaxed for parms, and that no parm
  4470.          needs more than PARM_BOUNDARY, regardless of data type.  */
  4471.  
  4472.       if (PARM_BOUNDARY < TYPE_ALIGN (type))
  4473.         {
  4474.           int boundary = PARM_BOUNDARY;
  4475.  
  4476.           /* Determine the boundary to pad up to.  */
  4477.           if (TYPE_ALIGN (type) > boundary)
  4478.         boundary = TYPE_ALIGN (type);
  4479.           if (boundary > MAX_PARM_BOUNDARY)
  4480.         boundary = MAX_PARM_BOUNDARY;
  4481.  
  4482.           /* If the previous args don't reach such a boundary,
  4483.          advance to the next one.  */
  4484.           boundary /= BITS_PER_UNIT;
  4485.           args[i].offset.constant += boundary - 1;
  4486.           args[i].offset.constant &= ~(boundary - 1);
  4487.           args_size.constant += boundary - 1;
  4488.           args_size.constant &= ~(boundary - 1);
  4489.  
  4490.           if (args_size.var != 0)
  4491.         abort ();        /* This case not implemented yet */
  4492.         }
  4493. #endif /* MAX_PARM_BOUNDARY */
  4494.  
  4495. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  4496.       args[i].partial
  4497.         = FUNCTION_ARG_PARTIAL_NREGS (args_so_far,
  4498.                       TYPE_MODE (type), type,
  4499.                       i < n_named_args);
  4500. #endif
  4501.     }
  4502.  
  4503.       /* Compute the stack-size of this argument.  */
  4504.  
  4505.       if (args[i].reg != 0 && args[i].partial == 0
  4506.       && ! stack_count_regparms)
  4507.     /* On most machines, don't count stack space for a register arg.  */
  4508.     ;
  4509.       else if (TYPE_MODE (type) != BLKmode)
  4510.     {
  4511.       register int size;
  4512.  
  4513.       size = GET_MODE_SIZE (TYPE_MODE (type));
  4514.       /* Compute how much space the push instruction will push.
  4515.          On many machines, pushing a byte will advance the stack
  4516.          pointer by a halfword.  */
  4517. #ifdef PUSH_ROUNDING
  4518.       size = PUSH_ROUNDING (size);
  4519. #endif
  4520.       /* Compute how much space the argument should get:
  4521.          maybe pad to a multiple of the alignment for arguments.  */
  4522.       if (none == FUNCTION_ARG_PADDING (TYPE_MODE (type), const0_rtx))
  4523.         args[i].size.constant = size;
  4524.       else
  4525.         args[i].size.constant
  4526.           = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
  4527.           / (PARM_BOUNDARY / BITS_PER_UNIT))
  4528.          * (PARM_BOUNDARY / BITS_PER_UNIT));
  4529.     }
  4530.       else
  4531.     {
  4532.       register tree size = size_in_bytes (type);
  4533.  
  4534.       /* A nonscalar.  Round its size up to a multiple
  4535.          of PARM_BOUNDARY bits, unless it is not supposed to be padded.  */
  4536.       if (none
  4537.           != FUNCTION_ARG_PADDING (TYPE_MODE (type),
  4538.                        expand_expr (size, 0, VOIDmode, 0)))
  4539.         size = convert_units (convert_units (size, BITS_PER_UNIT,
  4540.                          PARM_BOUNDARY),
  4541.                   PARM_BOUNDARY, BITS_PER_UNIT);
  4542.       ADD_PARM_SIZE (args[i].size, size);
  4543.  
  4544.       /* Certain data types may not be passed in registers
  4545.          (eg C++ classes with constructors).
  4546.          Also, BLKmode parameters initialized from CALL_EXPRs
  4547.          are treated specially, if it is a win to do so.  */
  4548.       if (TREE_CODE (TREE_VALUE (p)) == CALL_EXPR
  4549.           || TREE_ADDRESSABLE (type))
  4550.         {
  4551.           if (TREE_ADDRESSABLE (type))
  4552.         BLKmode_parms_forced = 1;
  4553.           /* This is a marker for such a parameter.  */
  4554.           args[i].stack = const0_rtx;
  4555.           BLKmode_parms_sizes += TREE_INT_CST_LOW (size);
  4556.  
  4557.           /* If this parm's location is "below" the nominal stack pointer,
  4558.          note to decrement the stack pointer while it is computed.  */
  4559. #ifdef FIRST_PARM_CALLER_OFFSET
  4560.           if (BLKmode_parms_first_offset == 0)
  4561.         BLKmode_parms_first_offset
  4562.           /* If parameter's offset is variable, assume the worst.  */
  4563.           = (args[i].offset.var
  4564.              ? FIRST_PARM_CALLER_OFFSET (funtype)
  4565.              : args[i].offset.constant);
  4566. #endif
  4567.         }
  4568.     }
  4569.  
  4570.       /* If a part of the arg was put into registers,
  4571.      don't include that part in the amount pushed.  */
  4572.       if (! stack_count_regparms)
  4573.     args[i].size.constant
  4574.       -= ((args[i].partial * UNITS_PER_WORD)
  4575.           / (PARM_BOUNDARY / BITS_PER_UNIT)
  4576.           * (PARM_BOUNDARY / BITS_PER_UNIT));
  4577.  
  4578.       /* Update ARGS_SIZE, the total stack space for args so far.  */
  4579.  
  4580.       args_size.constant += args[i].size.constant;
  4581.       if (args[i].size.var)
  4582.     {
  4583.       ADD_PARM_SIZE (args_size, args[i].size.var);
  4584.     }
  4585.  
  4586.       /* Increment ARGS_SO_FAR, which has info about which arg-registers
  4587.      have been used, etc.  */
  4588.  
  4589.       FUNCTION_ARG_ADVANCE (args_so_far, TYPE_MODE (type), type,
  4590.                 i < n_named_args);
  4591.     }
  4592.  
  4593.   /* If we would have to push a partially-in-regs parm
  4594.      before other stack parms, preallocate stack space instead.  */
  4595.   must_preallocate = 0;
  4596.   {
  4597.     int partial_seen = 0;
  4598.     for (i = 0; i < num_actuals; i++)
  4599.       {
  4600.     if (args[i].partial > 0)
  4601.       partial_seen = 1;
  4602.     else if (partial_seen && args[i].reg == 0)
  4603.       must_preallocate = 1;
  4604.       }
  4605.   }
  4606.  
  4607.   /* Precompute all register parameters.  It isn't safe to compute anything
  4608.      once we have started filling any specific hard regs.
  4609.      If this function call is cse'able, precompute all the parameters.  */
  4610.  
  4611.   reg_parm_seen = 0;
  4612.   for (i = 0; i < num_actuals; i++)
  4613.     if (args[i].reg != 0 || is_const)
  4614.       {
  4615.     int j;
  4616.     int struct_value_lossage = 0;
  4617.  
  4618.     /* First, see if this is a precomputed struct-returning function call
  4619.        and other subsequent parms are also such.  */
  4620.     if ((TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
  4621.          || RETURN_IN_MEMORY (TREE_TYPE (args[i].tree_value)))
  4622.         && TREE_CODE (args[i].tree_value) == CALL_EXPR)
  4623.       for (j = i + 1; j < num_actuals; j++)
  4624.         if (((TYPE_MODE (TREE_TYPE (args[j].tree_value)) == BLKmode
  4625.           || RETURN_IN_MEMORY (TREE_TYPE (args[j].tree_value)))
  4626.          && TREE_CODE (args[j].tree_value) == CALL_EXPR
  4627.          && args[j].reg != 0) || is_const)
  4628.           {
  4629.         /* We have two precomputed structure-values call expressions
  4630.            in our parm list.  Both of them would normally use
  4631.            the structure-value block.  To avoid the conflict,
  4632.            compute this parm with a different temporary block.  */
  4633.         int size = int_size_in_bytes (TREE_TYPE (args[i].tree_value));
  4634.         rtx structval = assign_stack_local (BLKmode, size);
  4635.         args[i].value = expand_expr (args[i].tree_value, structval,
  4636.                          VOIDmode, 0);
  4637.         struct_value_lossage = 1;
  4638.         break;
  4639.           }
  4640.     if (!struct_value_lossage)
  4641.       args[i].value = expand_expr (args[i].tree_value, 0, VOIDmode, 0);
  4642.  
  4643.     if (args[i].reg != 0)
  4644.       reg_parm_seen = 1;
  4645.  
  4646.     if (GET_CODE (args[i].value) != MEM
  4647.         && ! CONSTANT_P (args[i].value)
  4648.         && GET_CODE (args[i].value) != CONST_DOUBLE)
  4649.       args[i].value
  4650.         = force_reg (TYPE_MODE (TREE_TYPE (args[i].tree_value)),
  4651.              args[i].value);
  4652.     /* ANSI doesn't require a sequence point here,
  4653.        but PCC has one, so this will avoid some problems.  */
  4654.     emit_queue ();
  4655.       }
  4656.  
  4657.   /* Get the function to call, in the form of RTL, if it is a constant.  */
  4658.   if (fndecl && is_const)
  4659.     {
  4660.       /* Get a SYMBOL_REF rtx for the function address.  */
  4661.       funexp = XEXP (DECL_RTL (fndecl), 0);
  4662.  
  4663. #ifndef NO_FUNCTION_CSE
  4664.       /* Pass the address through a pseudoreg, if desired,
  4665.      before the "beginning" of the library call.
  4666.      So this insn isn't "part of" the library call, in case that
  4667.      is deleted, or cse'd.  */
  4668.       if (! flag_no_function_cse)
  4669.     funexp = copy_to_mode_reg (Pmode, funexp);
  4670. #endif
  4671.     }
  4672.  
  4673.   /* Now we are about to start emitting insns that can be deleted
  4674.      if the libcall is deleted.  */
  4675.   insn_before = get_last_insn ();
  4676.  
  4677.   /* Maybe do additional rounding on the size of the arguments.  */
  4678. #ifdef STACK_ARGS_ADJUST
  4679.   STACK_ARGS_ADJUST (args_size);
  4680. #endif
  4681.  
  4682.   /* If we have no actual push instructions, or shouldn't use them,
  4683.      or we need a variable amount of space, make space for all args right now.
  4684.      Round the needed size up to multiple of STACK_BOUNDARY.  */
  4685.  
  4686.   if (args_size.var != 0)
  4687.     {
  4688.       old_stack_level = copy_to_mode_reg (Pmode, stack_pointer_rtx);
  4689.       old_pending_adj = pending_stack_adjust;
  4690.       argblock = push_block (round_push (ARGS_SIZE_RTX (args_size)));
  4691.     }
  4692.   else if (args_size.constant > 0)
  4693.     {
  4694.       int needed = args_size.constant;
  4695.  
  4696. #ifdef STACK_BOUNDARY
  4697.       needed = (needed + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES;
  4698. #endif
  4699.       args_size.constant = needed;
  4700.  
  4701.       if (
  4702. #ifndef PUSH_ROUNDING
  4703.       1  /* Always preallocate if no push insns.  */
  4704. #else
  4705.       must_preallocate || BLKmode_parms_forced
  4706.       || BLKmode_parms_sizes > (args_size.constant >> 1)
  4707. #endif
  4708.       )
  4709.     {
  4710.       /* Try to reuse some or all of the pending_stack_adjust
  4711.          to get this space.  Maybe we can avoid any pushing.  */
  4712.       if (needed > pending_stack_adjust)
  4713.         {
  4714.           needed -= pending_stack_adjust;
  4715.           pending_stack_adjust = 0;
  4716.         }
  4717.       else
  4718.         {
  4719.           pending_stack_adjust -= needed;
  4720.           needed = 0;
  4721.         }
  4722.       argblock = push_block (gen_rtx (CONST_INT, VOIDmode, needed));
  4723.  
  4724.       /* Once this space is used, we cannot give other calls
  4725.          (which might be part of the args to this call)
  4726.          access to this space.  This is because there is
  4727.          no way to say that we are building arguments
  4728.          in a place which should not be deallocated by
  4729.          `emit_call_1', which, by the way, is the way this
  4730.          this space gets deallocated.  */
  4731.       do_pending_stack_adjust ();
  4732.     }
  4733.     }
  4734. #ifndef PUSH_ROUNDING
  4735.   else if (BLKmode_parms_forced)
  4736.     {
  4737.       /* If we have reg-parms that need to be temporarily on the stack,
  4738.      set up an arg block address even though there is no space
  4739.      to be allocated for it.  */
  4740.       argblock = push_block (const0_rtx);
  4741.     }
  4742. #endif
  4743.  
  4744. #if 0
  4745.   /* If stack needs padding below the args, increase all arg offsets
  4746.      so the args are stored above the padding.  */
  4747.   if (stack_padding)
  4748.     for (i = 0; i < num_actuals; i++)
  4749.       args[i].offset.constant += stack_padding;
  4750. #endif
  4751.  
  4752.   /* Don't try to defer pops if preallocating, not even from the first arg,
  4753.      since ARGBLOCK probably refers to the SP.  */
  4754.   if (argblock)
  4755.     NO_DEFER_POP;
  4756.  
  4757. #ifdef STACK_GROWS_DOWNWARD
  4758.   /* If any BLKmode parms need to be preallocated in space
  4759.      below the nominal stack-pointer address, we need to adjust the
  4760.      stack pointer so that this location is temporarily above it.
  4761.      This ensures that computation won't clobber that space.  */
  4762.   if (BLKmode_parms_first_offset < 0 && argblock != 0)
  4763.     {
  4764.       int needed = -BLKmode_parms_first_offset;
  4765.       argblock = copy_to_reg (argblock);
  4766.  
  4767. #ifdef STACK_BOUNDARY
  4768.       needed = (needed + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES;
  4769. #endif
  4770.       protected_stack = gen_rtx (CONST_INT, VOIDmode, needed);
  4771.       anti_adjust_stack (protected_stack);
  4772.     }
  4773. #endif /* STACK_GROWS_DOWNWARD */
  4774.  
  4775.   /* Get the function to call, in the form of RTL.  */
  4776.   if (fndecl)
  4777.     /* Get a SYMBOL_REF rtx for the function address.  */
  4778.     funexp = XEXP (DECL_RTL (fndecl), 0);
  4779.   else
  4780.     /* Generate an rtx (probably a pseudo-register) for the address.  */
  4781.     {
  4782.       funexp = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  4783.       emit_queue ();
  4784.     }
  4785.  
  4786.   /* Figure out the register where the value, if any, will come back.  */
  4787.   valreg = 0;
  4788.   if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
  4789.       && TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
  4790.     valreg = hard_function_value (TREE_TYPE (exp), fndecl);
  4791.  
  4792.   /* Now compute and store all non-register parms.
  4793.      These come before register parms, since they can require block-moves,
  4794.      which could clobber the registers used for register parms.
  4795.      Parms which have partial registers are not stored here,
  4796.      but we do preallocate space here if they want that.  */
  4797.  
  4798.   for (i = 0; i < num_actuals; i++)
  4799.     {
  4800.       /* Preallocate the stack space for a parm if appropriate
  4801.      so it can be computed directly in the stack space.  */
  4802.       if (args[i].stack != 0 && argblock != 0)
  4803.     args[i].stack = target_for_arg (TREE_TYPE (args[i].tree_value),
  4804.                     ARGS_SIZE_RTX (args[i].size),
  4805.                     argblock, args[i].offset);
  4806.       else
  4807.     args[i].stack = 0;
  4808.  
  4809.       if (args[i].reg == 0
  4810.       && TYPE_SIZE (TREE_TYPE (args[i].tree_value)) != 0)
  4811.     store_one_arg (&args[i], argblock, may_be_alloca);
  4812.     }
  4813.  
  4814.   /* Now store any partially-in-registers parm.
  4815.      This is the last place a block-move can happen.  */
  4816.   if (reg_parm_seen)
  4817.     for (i = 0; i < num_actuals; i++)
  4818.       if (args[i].partial != 0)
  4819.     store_one_arg (&args[i], argblock, may_be_alloca);
  4820.  
  4821.   if (protected_stack != 0)
  4822.     adjust_stack (protected_stack);
  4823.  
  4824.   /* Pass the function the address in which to return a structure value.  */
  4825.   if (structure_value_addr && ! structure_value_addr_parm)
  4826.     emit_move_insn (struct_value_rtx,
  4827.             force_reg (Pmode, force_operand (structure_value_addr, 0)));
  4828.  
  4829.   /* Now set up any wholly-register parms.  They were computed already.  */
  4830.   if (reg_parm_seen)
  4831.     for (i = 0; i < num_actuals; i++)
  4832.       if (args[i].reg != 0 && args[i].partial == 0)
  4833.     store_one_arg (&args[i], argblock, may_be_alloca);
  4834.  
  4835.   /* Perform postincrements before actually calling the function.  */
  4836.   emit_queue ();
  4837.  
  4838.   /* All arguments and registers used for the call must be set up by now!  */
  4839.  
  4840.   /* ??? Other languages need a nontrivial second argument (static chain).  */
  4841.   funexp = prepare_call_address (funexp, 0);
  4842.  
  4843.   /* Mark all register-parms as living through the call.  */
  4844.   start_sequence ();
  4845.   for (i = 0; i < num_actuals; i++)
  4846.     if (args[i].reg != 0)
  4847.       {
  4848.     if (args[i].partial > 0)
  4849.       use_regs (REGNO (args[i].reg), args[i].partial);
  4850.     else if (GET_MODE (args[i].reg) == BLKmode)
  4851.       use_regs (REGNO (args[i].reg),
  4852.             ((int_size_in_bytes (TREE_TYPE (args[i].tree_value))
  4853.               + UNITS_PER_WORD - 1)
  4854.              / UNITS_PER_WORD));
  4855.     else
  4856.       emit_insn (gen_rtx (USE, VOIDmode, args[i].reg));
  4857.       }
  4858.  
  4859.   if (structure_value_addr && ! structure_value_addr_parm
  4860.       && GET_CODE (struct_value_rtx) == REG)
  4861.     emit_insn (gen_rtx (USE, VOIDmode, struct_value_rtx));
  4862.  
  4863.   use_insns = gen_sequence ();
  4864.   end_sequence ();
  4865.  
  4866.   /* Generate the actual call instruction.  */
  4867.   /* This also has the effect of turning off any pop-inhibition
  4868.      done in expand_call.  */
  4869.   if (args_size.constant < 0)
  4870.     args_size.constant = 0;
  4871.   emit_call_1 (funexp, funtype, args_size.constant,
  4872.            FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
  4873.            valreg, old_inhibit_defer_pop, use_insns);
  4874.  
  4875. /* ???  Nothing has been done here to record control flow
  4876.    when contained functions can do nonlocal gotos.  */
  4877.  
  4878.   /* For calls to `setjmp', etc., inform flow.c it should complain
  4879.      if nonvolatile values are live.  */
  4880.  
  4881.   if (is_setjmp)
  4882.     {
  4883.       emit_note (IDENTIFIER_POINTER (DECL_NAME (fndecl)), NOTE_INSN_SETJMP);
  4884.       current_function_calls_setjmp = 1;
  4885.     }
  4886.  
  4887.   /* Notice functions that cannot return.
  4888.      If optimizing, insns emitted below will be dead.
  4889.      If not optimizing, they will exist, which is useful
  4890.      if the user uses the `return' command in the debugger.  */
  4891.  
  4892.   if (fndecl && TREE_THIS_VOLATILE (fndecl))
  4893.     emit_barrier ();
  4894.  
  4895.   /* For calls to __builtin_new, note that it can never return 0.
  4896.      This is because a new handler will be called, and 0 it not
  4897.      among the numbers it is supposed to return.  */
  4898. #if 0
  4899.   if (is_builtin_new)
  4900.     emit_note (IDENTIFIER_POINTER (DECL_NAME (fndecl)), NOTE_INSN_BUILTIN_NEW);
  4901. #endif
  4902.  
  4903.   /* If there are cleanups to be called, don't use a hard reg as target.  */
  4904.   if (cleanups_this_call != old_cleanups
  4905.       && target && REG_P (target)
  4906.       && REGNO (target) < FIRST_PSEUDO_REGISTER)
  4907.     target = 0;
  4908.  
  4909.   /* If value type not void, return an rtx for the value.  */
  4910.  
  4911.   if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode
  4912.       || ignore)
  4913.     {
  4914.       target = const0_rtx;
  4915.     }
  4916.   else if (structure_value_addr)
  4917.     {
  4918.       if (target == 0 || GET_CODE (target) != MEM)
  4919.     target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  4920.               memory_address (BLKmode, structure_value_addr));
  4921.     }
  4922.   else if (pcc_struct_value)
  4923.     {
  4924.       valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
  4925.                     fndecl);
  4926.       if (target == 0)
  4927.     target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  4928.               copy_to_reg (valreg));
  4929.       else if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
  4930.     emit_move_insn (target, gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  4931.                      copy_to_reg (valreg)));
  4932.       else
  4933.     emit_block_move (target, gen_rtx (MEM, BLKmode, copy_to_reg (valreg)),
  4934.              expr_size (exp),
  4935.              TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  4936.     }
  4937.   else if (target && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp)))
  4938.     {
  4939.       if (!rtx_equal_p (target, valreg))
  4940.     emit_move_insn (target, valreg);
  4941.       else
  4942.     /* This tells expand_inline_function to copy valreg to its target.  */
  4943.     emit_insn (gen_rtx (USE, VOIDmode, valreg));
  4944.     }
  4945.   else
  4946.     target = copy_to_reg (valreg);
  4947.  
  4948.   /* Perform all cleanups needed for the arguments of this call
  4949.      (i.e. destructors in C++).  */
  4950.   expand_cleanups_to (old_cleanups);
  4951.  
  4952.   /* If size of args is variable, restore saved stack-pointer value.  */
  4953.  
  4954.   if (old_stack_level)
  4955.     {
  4956.       emit_move_insn (stack_pointer_rtx, old_stack_level);
  4957.       pending_stack_adjust = old_pending_adj;
  4958.     }
  4959.  
  4960.   /* If call is cse'able, make appropriate pair of reg-notes around it.  */
  4961.   if (is_const)
  4962.     {
  4963.       rtx insn_first = NEXT_INSN (insn_before);
  4964.       rtx insn_last = get_last_insn ();
  4965.       rtx note = 0;
  4966.  
  4967.       /* Don't put the notes on if we don't have insns that can hold them.  */
  4968.       if ((GET_CODE (insn_first) == INSN
  4969.        || GET_CODE (insn_first) == CALL_INSN
  4970.        || GET_CODE (insn_first) == JUMP_INSN)
  4971.       && (GET_CODE (insn_last) == INSN
  4972.           || GET_CODE (insn_last) == CALL_INSN
  4973.           || GET_CODE (insn_last) == JUMP_INSN))
  4974.     {
  4975.       /* Construct an "equal form" for the value
  4976.          which mentions all the arguments in order
  4977.          as well as the function name.  */
  4978.       for (i = 0; i < num_actuals; i++)
  4979.         if (args[i].reg != 0 || is_const)
  4980.           note = gen_rtx (EXPR_LIST, VOIDmode, args[i].value, note);
  4981.       note = gen_rtx (EXPR_LIST, VOIDmode,
  4982.               XEXP (DECL_RTL (fndecl), 0), note);
  4983.  
  4984.       REG_NOTES (insn_last)
  4985.         = gen_rtx (EXPR_LIST, REG_EQUAL, note,
  4986.                gen_rtx (INSN_LIST, REG_RETVAL, insn_first,
  4987.                 REG_NOTES (insn_last)));
  4988.       REG_NOTES (insn_first)
  4989.         = gen_rtx (INSN_LIST, REG_LIBCALL, insn_last,
  4990.                REG_NOTES (insn_first));
  4991.     }
  4992.     }
  4993.  
  4994.   return target;
  4995. }
  4996.  
  4997. /* Return an rtx which represents a suitable home on the stack
  4998.    given TYPE, the type of the argument looking for a home.
  4999.    This is called only for BLKmode arguments.
  5000.  
  5001.    SIZE is the size needed for this target.
  5002.    ARGS_ADDR is the address of the bottom of the argument block for this call.
  5003.    OFFSET describes this parameter's offset into ARGS_ADDR.  It is meaningless
  5004.    if this machine uses push insns.  */
  5005.  
  5006. static rtx
  5007. target_for_arg (type, size, args_addr, offset)
  5008.      tree type;
  5009.      rtx size;
  5010.      rtx args_addr;
  5011.      struct args_size offset;
  5012. {
  5013.   rtx target;
  5014.   rtx offset_rtx = ARGS_SIZE_RTX (offset);
  5015.  
  5016.   /* We do not call memory_address if possible,
  5017.      because we want to address as close to the stack
  5018.      as possible.  For non-variable sized arguments,
  5019.      this will be stack-pointer relative addressing.  */
  5020.   if (GET_CODE (offset_rtx) == CONST_INT)
  5021.     target = plus_constant (args_addr, INTVAL (offset_rtx));
  5022.   else
  5023.     {
  5024.       /* I have no idea how to guarantee that this
  5025.      will work in the presence of register parameters.  */
  5026.       target = gen_rtx (PLUS, Pmode, args_addr, offset_rtx);
  5027.       target = memory_address (QImode, target);
  5028.     }
  5029.  
  5030.   return gen_rtx (MEM, BLKmode, target);
  5031. }
  5032.  
  5033. /* Store a single argument for a function call
  5034.    into the register or memory area where it must be passed.
  5035.    *ARG describes the argument value and where to pass it.
  5036.    ARGBLOCK is the address of the stack-block for all the arguments,
  5037.    or 0 on a machine where arguemnts are pushed individually.
  5038.    MAY_BE_ALLOCA nonzero says this could be a call to `alloca'
  5039.    so must be careful about how the stack is used.  */
  5040.  
  5041. static void
  5042. store_one_arg (arg, argblock, may_be_alloca)
  5043.      struct arg_data *arg;
  5044.      rtx argblock;
  5045.      int may_be_alloca;
  5046. {
  5047.   register tree pval = arg->tree_value;
  5048.   int used = 0;
  5049.  
  5050.   if (TREE_CODE (pval) == ERROR_MARK)
  5051.     return;
  5052.  
  5053.   if (arg->reg != 0 && arg->partial == 0)
  5054.     {
  5055.       /* Being passed entirely in a register.  */
  5056.       if (arg->value != 0)
  5057.     {
  5058.       if (GET_MODE (arg->value) == BLKmode)
  5059.         move_block_to_reg (REGNO (arg->reg), arg->value,
  5060.                    ((int_size_in_bytes (TREE_TYPE (pval))
  5061.                  + UNITS_PER_WORD - 1)
  5062.                 / UNITS_PER_WORD));
  5063.       else
  5064.         emit_move_insn (arg->reg, arg->value);
  5065.     }
  5066.       else
  5067.     store_expr (pval, arg->reg, 0);
  5068.  
  5069.       /* Don't allow anything left on stack from computation
  5070.      of argument to alloca.  */
  5071.       if (may_be_alloca)
  5072.     do_pending_stack_adjust ();
  5073.     }
  5074.   else if (TYPE_MODE (TREE_TYPE (pval)) != BLKmode)
  5075.     {
  5076.       register int size;
  5077.       rtx tem;
  5078.  
  5079.       /* Argument is a scalar, not entirely passed in registers.
  5080.      (If part is passed in registers, arg->partial says how much
  5081.      and emit_push_insn will take care of putting it there.)
  5082.      
  5083.      Push it, and if its size is less than the
  5084.      amount of space allocated to it,
  5085.      also bump stack pointer by the additional space.
  5086.      Note that in C the default argument promotions
  5087.      will prevent such mismatches.  */
  5088.  
  5089.       used = size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (pval)));
  5090.       /* Compute how much space the push instruction will push.
  5091.      On many machines, pushing a byte will advance the stack
  5092.      pointer by a halfword.  */
  5093. #ifdef PUSH_ROUNDING
  5094.       size = PUSH_ROUNDING (size);
  5095. #endif
  5096.       /* Compute how much space the argument should get:
  5097.      round up to a multiple of the alignment for arguments.  */
  5098.       if (none != FUNCTION_ARG_PADDING (TYPE_MODE (TREE_TYPE (pval)), const0_rtx))
  5099.     used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
  5100.          / (PARM_BOUNDARY / BITS_PER_UNIT))
  5101.         * (PARM_BOUNDARY / BITS_PER_UNIT));
  5102.  
  5103.       tem = arg->value;
  5104.       if (tem == 0)
  5105.     {
  5106.       tem = expand_expr (pval, 0, VOIDmode, 0);
  5107.       /* ANSI doesn't require a sequence point here,
  5108.          but PCC has one, so this will avoid some problems.  */
  5109.       emit_queue ();
  5110.     }
  5111.  
  5112.       /* Don't allow anything left on stack from computation
  5113.      of argument to alloca.  */
  5114.       if (may_be_alloca)
  5115.     do_pending_stack_adjust ();
  5116.  
  5117.       emit_push_insn (tem, TYPE_MODE (TREE_TYPE (pval)), 0, 0,
  5118.               arg->partial, arg->reg, used - size,
  5119.               argblock, ARGS_SIZE_RTX (arg->offset));
  5120.     }
  5121.   else if (arg->stack != 0)
  5122.     {
  5123.       /* BLKmode parm, not entirely passed in registers,
  5124.      and with space already allocated.  */
  5125.  
  5126.       tree sizetree = size_in_bytes (TREE_TYPE (pval));
  5127.  
  5128.       /* Find out if the parm needs padding, and whether above or below.  */
  5129.       enum direction where_pad
  5130.     = FUNCTION_ARG_PADDING (TYPE_MODE (TREE_TYPE (pval)),
  5131.                 expand_expr (sizetree, 0, VOIDmode, 0));
  5132.  
  5133.       /* If it is padded below, adjust the stack address
  5134.      upward over the padding.  */
  5135.  
  5136.       if (where_pad == downward)
  5137.     {
  5138.       rtx offset_rtx;
  5139.       rtx address = XEXP (arg->stack, 0);
  5140.       struct args_size stack_offset;
  5141.       /* Hack for C++: see assign_parms for symmetric code.  */
  5142.       int extra = 0;
  5143.  
  5144.       stack_offset.constant = 0;
  5145.       stack_offset.var = 0;
  5146.  
  5147.       if (TREE_INT_CST_LOW (sizetree) * BITS_PER_UNIT != PARM_BOUNDARY)
  5148.         {
  5149.           /* Round the size up to multiple of PARM_BOUNDARY bits.  */
  5150.           tree s1 = convert_units (sizetree, BITS_PER_UNIT, PARM_BOUNDARY);
  5151.           tree s2 = convert_units (s1, PARM_BOUNDARY, BITS_PER_UNIT);
  5152.           /* Compute amount of padding.  */
  5153.           ADD_PARM_SIZE (stack_offset, s2);
  5154.           SUB_PARM_SIZE (stack_offset, sizetree);
  5155.           extra = stack_offset.constant % UNITS_PER_WORD;
  5156.           stack_offset.constant -= extra;
  5157.         }
  5158.       offset_rtx = ARGS_SIZE_RTX (stack_offset);
  5159.  
  5160.       /* If there is rounding to do for a BLKmode parameter,
  5161.          add it in here, since STACK_OFFSET is not used for the
  5162.          rest of this iteration.  */
  5163.       stack_offset.constant += extra;
  5164.  
  5165.       /* Adjust the address to store at.  */
  5166.       if (GET_CODE (offset_rtx) == CONST_INT)
  5167.         address = plus_constant (address, INTVAL (offset_rtx));
  5168.       else
  5169.         {
  5170.           address = gen_rtx (PLUS, Pmode, address, offset_rtx);
  5171.           address = memory_address (QImode, address);
  5172.         }
  5173.       arg->stack = change_address (arg->stack, VOIDmode, address);
  5174.     }
  5175.  
  5176.       /* ARG->stack probably refers to the stack-pointer.  If so,
  5177.      stabilize it, in case stack-pointer changes during evaluation.  */
  5178.       if (reg_mentioned_p (stack_pointer_rtx, arg->stack))
  5179.     arg->stack = change_address (arg->stack, VOIDmode,
  5180.                      copy_to_reg (XEXP (arg->stack, 0)));
  5181.       /* BLKmode argument that should go in a prespecified stack location.  */
  5182.       if (arg->value == 0)
  5183.     /* Not yet computed => compute it there.  */
  5184.     /* ??? This should be changed to tell expand_expr
  5185.        that it can store directly in the target.  */
  5186.     arg->value = store_expr (arg->tree_value, arg->stack, 0);
  5187.       else if (arg->value != arg->stack)
  5188.     /* It was computed somewhere, but not where we wanted.
  5189.        For example, the value may have come from an official
  5190.        local variable or parameter.  In that case, expand_expr
  5191.        does not fill our suggested target.  */
  5192.     emit_block_move (arg->stack, arg->value, ARGS_SIZE_RTX (arg->size),
  5193.              TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT);
  5194.  
  5195.       /* Now, if this value wanted to be partly in registers,
  5196.      move the value from the stack to the registers
  5197.      that are supposed to hold the values.  */
  5198.       if (arg->partial > 0)
  5199.     move_block_to_reg (REGNO (arg->reg), arg->stack, arg->partial);
  5200.     }
  5201.   else
  5202.     {
  5203.       /* BLKmode, at least partly to be pushed.  */
  5204.  
  5205.       register rtx tem
  5206.     = arg->value ? arg->value : expand_expr (pval, 0, VOIDmode, 0);
  5207.       register int excess;
  5208.       rtx size_rtx;
  5209.  
  5210.       /* Pushing a nonscalar.
  5211.      If part is passed in registers, arg->partial says how much
  5212.      and emit_push_insn will take care of putting it there.  */
  5213.  
  5214.       /* Round its size up to a multiple
  5215.      of the allocation unit for arguments.  */
  5216.  
  5217.       if (arg->size.var != 0)
  5218.     {
  5219.       excess = 0;
  5220.       size_rtx = ARGS_SIZE_RTX (arg->size);
  5221.     }
  5222.       else
  5223.     {
  5224.       register tree size = size_in_bytes (TREE_TYPE (pval));
  5225.       /* PUSH_ROUNDING has no effect on us, because
  5226.          emit_push_insn for BLKmode is careful to avoid it.  */
  5227.       excess = (arg->size.constant - TREE_INT_CST_LOW (size)
  5228.             + arg->partial * UNITS_PER_WORD);
  5229.       size_rtx = expand_expr (size, 0, VOIDmode, 0);
  5230.     }
  5231.  
  5232.       /* if (arg->stack) */
  5233.       /*   abort ();     */
  5234.  
  5235.       emit_push_insn (tem, TYPE_MODE (TREE_TYPE (pval)), size_rtx,
  5236.               TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT,
  5237.               arg->partial, arg->reg, excess, argblock,
  5238.               ARGS_SIZE_RTX (arg->offset));
  5239.     }
  5240.  
  5241.   /* Once we have pushed something, pops can't safely
  5242.      be deferred during the rest of the arguments.  */
  5243.   NO_DEFER_POP;
  5244. }
  5245.  
  5246. /* Expand conditional expressions.  */
  5247.  
  5248. /* Generate code to evaluate EXP and jump to LABEL if the value is zero.
  5249.    LABEL is an rtx of code CODE_LABEL, in this function and all the
  5250.    functions here.  */
  5251.  
  5252. void
  5253. jumpifnot (exp, label)
  5254.      tree exp;
  5255.      rtx label;
  5256. {
  5257.   do_jump (exp, label, 0);
  5258. }
  5259.  
  5260. /* Generate code to evaluate EXP and jump to LABEL if the value is nonzero.  */
  5261.  
  5262. void
  5263. jumpif (exp, label)
  5264.      tree exp;
  5265.      rtx label;
  5266. {
  5267.   do_jump (exp, 0, label);
  5268. }
  5269.  
  5270. /* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if
  5271.    the result is zero, or IF_TRUE_LABEL if the result is one.
  5272.    Either of IF_FALSE_LABEL and IF_TRUE_LABEL may be zero,
  5273.    meaning fall through in that case.
  5274.  
  5275.    This function is responsible for optimizing cases such as
  5276.    &&, || and comparison operators in EXP.  */
  5277.  
  5278. void
  5279. do_jump (exp, if_false_label, if_true_label)
  5280.      tree exp;
  5281.      rtx if_false_label, if_true_label;
  5282. {
  5283.   register enum tree_code code = TREE_CODE (exp);
  5284.   /* Some cases need to create a label to jump to
  5285.      in order to properly fall through.
  5286.      These cases set DROP_THROUGH_LABEL nonzero.  */
  5287.   rtx drop_through_label = 0;
  5288.   rtx temp;
  5289.   rtx comparison = 0;
  5290.  
  5291.   emit_queue ();
  5292.  
  5293.   switch (code)
  5294.     {
  5295.     case ERROR_MARK:
  5296.       break;
  5297.  
  5298.     case INTEGER_CST:
  5299.       temp = integer_zerop (exp) ? if_false_label : if_true_label;
  5300.       if (temp)
  5301.     emit_jump (temp);
  5302.       break;
  5303.  
  5304.     case ADDR_EXPR:
  5305.       /* The address of something can never be zero.  */
  5306.       if (if_true_label)
  5307.     emit_jump (if_true_label);
  5308.       break;
  5309.  
  5310.     case NOP_EXPR:
  5311.       do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
  5312.       break;
  5313.  
  5314.     case TRUTH_NOT_EXPR:
  5315.       do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
  5316.       break;
  5317.  
  5318.     case TRUTH_ANDIF_EXPR:
  5319.       if (if_false_label == 0)
  5320.     if_false_label = drop_through_label = gen_label_rtx ();
  5321.       do_jump (TREE_OPERAND (exp, 0), if_false_label, 0);
  5322.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  5323.       break;
  5324.  
  5325.     case TRUTH_ORIF_EXPR:
  5326.       if (if_true_label == 0)
  5327.     if_true_label = drop_through_label = gen_label_rtx ();
  5328.       do_jump (TREE_OPERAND (exp, 0), 0, if_true_label);
  5329.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  5330.       break;
  5331.  
  5332.     case COMPOUND_EXPR:
  5333.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  5334.       emit_queue ();
  5335.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  5336.       break;
  5337.  
  5338.     case COND_EXPR:
  5339.       {
  5340.     register rtx label1 = gen_label_rtx ();
  5341.     drop_through_label = gen_label_rtx ();
  5342.     do_jump (TREE_OPERAND (exp, 0), label1, 0);
  5343.     /* Now the THEN-expression.  */
  5344.     do_jump (TREE_OPERAND (exp, 1),
  5345.          if_false_label ? if_false_label : drop_through_label,
  5346.          if_true_label ? if_true_label : drop_through_label);
  5347.     emit_label (label1);
  5348.     /* Now the ELSE-expression.  */
  5349.     do_jump (TREE_OPERAND (exp, 2),
  5350.          if_false_label ? if_false_label : drop_through_label,
  5351.          if_true_label ? if_true_label : drop_through_label);
  5352.       }
  5353.       break;
  5354.  
  5355.     case EQ_EXPR:
  5356.       comparison = compare (exp, EQ, EQ, EQ, EQ);
  5357.       break;
  5358.  
  5359.     case NE_EXPR:
  5360.       comparison = compare (exp, NE, NE, NE, NE);
  5361.       break;
  5362.  
  5363.     case LT_EXPR:
  5364.       comparison = compare (exp, LT, LTU, GT, GTU);
  5365.       break;
  5366.  
  5367.     case LE_EXPR:
  5368.       comparison = compare (exp, LE, LEU, GE, GEU);
  5369.       break;
  5370.  
  5371.     case GT_EXPR:
  5372.       comparison = compare (exp, GT, GTU, LT, LTU);
  5373.       break;
  5374.  
  5375.     case GE_EXPR:
  5376.       comparison = compare (exp, GE, GEU, LE, LEU);
  5377.       break;
  5378.  
  5379.     default:
  5380.       temp = expand_expr (exp, 0, VOIDmode, 0);
  5381.       /* Copy to register to avoid generating bad insns by cse
  5382.      from (set (mem ...) (arithop))  (set (cc0) (mem ...)).  */
  5383.       if (!cse_not_expected && GET_CODE (temp) == MEM)
  5384.     temp = copy_to_reg (temp);
  5385.       do_pending_stack_adjust ();
  5386.       {
  5387.     rtx zero = CONST0_RTX (GET_MODE (temp));
  5388.  
  5389.     if (GET_CODE (temp) == CONST_INT)
  5390.       comparison = compare_constants (NE, 0,
  5391.                       INTVAL (temp), 0, BITS_PER_WORD);
  5392.     else if (GET_MODE (temp) != VOIDmode)
  5393.       comparison = compare1 (temp, zero, NE, NE, 0, GET_MODE (temp));
  5394.     else
  5395.       abort ();
  5396.       }
  5397.     }
  5398.  
  5399.   /* Do any postincrements in the expression that was tested.  */
  5400.   emit_queue ();
  5401.  
  5402.   /* If COMPARISON is nonzero here, it is an rtx that can be substituted
  5403.      straight into a conditional jump instruction as the jump condition.
  5404.      Otherwise, all the work has been done already.  */
  5405.  
  5406.   if (comparison == const1_rtx)
  5407.     {
  5408.       if (if_true_label)
  5409.     emit_jump (if_true_label);
  5410.     }
  5411.   else if (comparison == const0_rtx)
  5412.     {
  5413.       if (if_false_label)
  5414.     emit_jump (if_false_label);
  5415.     }
  5416.   else if (comparison)
  5417.     {
  5418.       if (if_true_label)
  5419.     {
  5420.       if (bcc_gen_fctn[(int) GET_CODE (comparison)] != 0)
  5421.         emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_true_label));
  5422.       else
  5423.         abort ();
  5424.  
  5425.       if (if_false_label)
  5426.         emit_jump (if_false_label);
  5427.     }
  5428.       else if (if_false_label)
  5429.     {
  5430.       rtx pat;
  5431.  
  5432.       if (bcc_gen_fctn[(int) GET_CODE (comparison)] == 0)
  5433.         abort ();
  5434.  
  5435.       pat = (*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_false_label);
  5436.       /* Now invert the sense of the jump by exchanging the two arms
  5437.          of each IF_THEN_ELSE.  Note that inverting the condition
  5438.          would be incorrect for IEEE floating point with nans!  */
  5439.       if (GET_CODE (pat) == SEQUENCE)
  5440.         {
  5441.           int i;
  5442.           /* We can invert a sequence if the only jump is at the end.  */
  5443.           for (i = 0; i < (int) (XVECLEN (pat, 0) - 1); i++)
  5444.         if (GET_CODE (XVECEXP (pat, 0, i)) == JUMP_INSN)
  5445.           abort ();
  5446.           invert_exp (PATTERN (XVECEXP (pat, 0, XVECLEN (pat, 0) - 1)),
  5447.               0, 0);
  5448.         }
  5449.       else
  5450.         invert_exp (pat, 0, 0);
  5451.  
  5452.       emit_jump_insn (pat);
  5453.     }
  5454.     }
  5455.  
  5456.   if (drop_through_label)
  5457.     emit_label (drop_through_label);
  5458. }
  5459.  
  5460. /* Compare two integer constant rtx's, OP0 and OP1.
  5461.    The comparison operation is OPERATION.
  5462.    Return an rtx representing the value 1 or 0.
  5463.    WIDTH is the width in bits that is significant.  */
  5464.  
  5465. static rtx
  5466. compare_constants (operation, unsignedp, op0, op1, width)
  5467.      enum rtx_code operation;
  5468.      int unsignedp;
  5469.      int op0, op1;
  5470.      int width;
  5471. {
  5472.   int val;
  5473.  
  5474.   /* Sign-extend or zero-extend the operands to a full word
  5475.      from an initial width of WIDTH bits.  */
  5476.   if (width < HOST_BITS_PER_INT)
  5477.     {
  5478.       op0 &= (1 << width) - 1;
  5479.       op1 &= (1 << width) - 1;
  5480.  
  5481.       if (! unsignedp)
  5482.     {
  5483.       if (op0 & (1 << (width - 1)))
  5484.         op0 |= ((-1) << width);
  5485.       if (op1 & (1 << (width - 1)))
  5486.         op1 |= ((-1) << width);
  5487.     }
  5488.     }
  5489.  
  5490.   switch (operation)
  5491.     {
  5492.     case EQ:
  5493.       val = op0 == op1;
  5494.       break;
  5495.  
  5496.     case NE:
  5497.       val = op0 != op1;
  5498.       break;
  5499.  
  5500.     case GT:
  5501.     case GTU:
  5502.       val = op0 > op1;
  5503.       break;
  5504.  
  5505.     case LT:
  5506.     case LTU:
  5507.       val = op0 < op1;
  5508.       break;
  5509.  
  5510.     case GE:
  5511.     case GEU:
  5512.       val = op0 >= op1;
  5513.       break;
  5514.  
  5515.     case LE:
  5516.     case LEU:
  5517.       val = op0 <= op1;
  5518.     }
  5519.  
  5520.   return val ? const1_rtx : const0_rtx;
  5521. }
  5522.  
  5523. /* Generate code for a comparison expression EXP
  5524.    (including code to compute the values to be compared)
  5525.    and set (CC0) according to the result.
  5526.    SIGNED_FORWARD should be the rtx operation for this comparison for
  5527.    signed data; UNSIGNED_FORWARD, likewise for use if data is unsigned.
  5528.    SIGNED_REVERSE and UNSIGNED_REVERSE are used if it is desirable
  5529.    to interchange the operands for the compare instruction.
  5530.  
  5531.    We force a stack adjustment unless there are currently
  5532.    things pushed on the stack that aren't yet used.  */
  5533.  
  5534. static rtx
  5535. compare (exp, signed_forward, unsigned_forward,
  5536.      signed_reverse, unsigned_reverse)
  5537.      register tree exp;
  5538.      enum rtx_code signed_forward, unsigned_forward;
  5539.      enum rtx_code signed_reverse, unsigned_reverse;
  5540. {
  5541.  
  5542.   register rtx op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5543.   register rtx op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  5544.   register enum machine_mode mode = GET_MODE (op0);
  5545.   int unsignedp;
  5546.  
  5547.   /* If one operand is 0, make it the second one.  */
  5548.  
  5549.   if (op0 == const0_rtx
  5550.       || (GET_MODE_CLASS (mode) == MODE_FLOAT && op0 == CONST0_RTX (mode)))
  5551.     {
  5552.       rtx tem = op0;
  5553.       op0 = op1;
  5554.       op1 = tem;
  5555.       signed_forward = signed_reverse;
  5556.       unsigned_forward = unsigned_reverse;
  5557.     }
  5558.  
  5559.   if (flag_force_mem)
  5560.     {
  5561.       op0 = force_not_mem (op0);
  5562.       op1 = force_not_mem (op1);
  5563.     }
  5564.  
  5565.   do_pending_stack_adjust ();
  5566.  
  5567.   unsignedp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)))
  5568.            || TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1))));
  5569.  
  5570.   if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT)
  5571.     return compare_constants (signed_forward, unsignedp,
  5572.                   INTVAL (op0), INTVAL (op1),
  5573.                   GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))));
  5574.  
  5575.   emit_cmp_insn (op0, op1,
  5576.          (mode == BLKmode) ? expr_size (TREE_OPERAND (exp, 0)) : 0,
  5577.          unsignedp,
  5578.          TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  5579.  
  5580.   return gen_rtx ((unsignedp ? unsigned_forward : signed_forward),
  5581.           VOIDmode, cc0_rtx, const0_rtx);
  5582. }
  5583.  
  5584. /* Like compare but expects the values to compare as two rtx's.
  5585.    The decision as to signed or unsigned comparison must be made by the caller.
  5586.    BLKmode is not allowed.  */
  5587.  
  5588. static rtx
  5589. compare1 (op0, op1, forward_op, reverse_op, unsignedp, mode)
  5590.      register rtx op0, op1;
  5591.      enum rtx_code forward_op, reverse_op;
  5592.      int unsignedp;
  5593.      enum machine_mode mode;
  5594. {
  5595.   /* If one operand is 0, make it the second one.  */
  5596.  
  5597.   if (op0 == const0_rtx
  5598.       || (GET_MODE_CLASS (mode) == MODE_FLOAT && op0 == CONST0_RTX (mode)))
  5599.     {
  5600.       rtx tem = op0;
  5601.       op0 = op1;
  5602.       op1 = tem;
  5603.       forward_op = reverse_op;
  5604.     }
  5605.  
  5606.   if (flag_force_mem)
  5607.     {
  5608.       op0 = force_not_mem (op0);
  5609.       op1 = force_not_mem (op1);
  5610.     }
  5611.  
  5612.   do_pending_stack_adjust ();
  5613.  
  5614.   if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT)
  5615.     return compare_constants (forward_op, unsignedp,
  5616.                   INTVAL (op0), INTVAL (op1),
  5617.                   GET_MODE_BITSIZE (mode));
  5618.  
  5619.   emit_cmp_insn (op0, op1, 0, unsignedp, 0);
  5620.  
  5621.   return gen_rtx (forward_op, VOIDmode, cc0_rtx, const0_rtx);
  5622. }
  5623.  
  5624. /* Generate code to calculate EXP using a store-flag instruction
  5625.    and return an rtx for the result.
  5626.    If TARGET is nonzero, store the result there if convenient.
  5627.  
  5628.    Return zero if there is no suitable set-flag instruction
  5629.    available on this machine.  */
  5630.  
  5631. static rtx
  5632. do_store_flag (exp, target, mode)
  5633.      tree exp;
  5634.      rtx target;
  5635.      enum machine_mode mode;
  5636. {
  5637.   register enum tree_code code = TREE_CODE (exp);
  5638.   register rtx comparison = 0;
  5639.   enum machine_mode compare_mode;
  5640.   rtx prev_insn = get_last_insn ();
  5641.   enum insn_code icode;
  5642.  
  5643.   switch (code)
  5644.     {
  5645. #ifdef HAVE_seq
  5646.     case EQ_EXPR:
  5647.       if (HAVE_seq)
  5648.     {
  5649.       comparison = compare (exp, EQ, EQ, EQ, EQ);
  5650.       icode = CODE_FOR_seq;
  5651.       compare_mode = insn_operand_mode[(int) CODE_FOR_seq][0];
  5652.     }
  5653.       break;
  5654. #endif
  5655.  
  5656. #ifdef HAVE_sne
  5657.     case NE_EXPR:
  5658.       if (HAVE_sne)
  5659.     {
  5660.       comparison = compare (exp, NE, NE, NE, NE);
  5661.       icode = CODE_FOR_sne;
  5662.       compare_mode = insn_operand_mode[(int) CODE_FOR_sne][0];
  5663.     }
  5664.       break;
  5665. #endif
  5666.  
  5667. #if defined (HAVE_slt) && defined (HAVE_sltu) && defined (HAVE_sgt) && defined (HAVE_sgtu)
  5668.     case LT_EXPR:
  5669.       if (HAVE_slt && HAVE_sltu && HAVE_sgt && HAVE_sgtu)
  5670.     {
  5671.       comparison = compare (exp, LT, LTU, GT, GTU);
  5672.       icode = CODE_FOR_slt;
  5673.       compare_mode = insn_operand_mode[(int) CODE_FOR_slt][0];
  5674.     }
  5675.       break;
  5676.  
  5677.     case GT_EXPR:
  5678.       if (HAVE_slt && HAVE_sltu && HAVE_sgt && HAVE_sgtu)
  5679.     {
  5680.       comparison = compare (exp, GT, GTU, LT, LTU);
  5681.       icode = CODE_FOR_slt;
  5682.       compare_mode = insn_operand_mode[(int) CODE_FOR_slt][0];
  5683.     }
  5684.       break;
  5685. #endif
  5686.  
  5687. #if defined (HAVE_sle) && defined (HAVE_sleu) && defined (HAVE_sge) && defined (HAVE_sgeu)
  5688.     case LE_EXPR:
  5689.       if (HAVE_sle && HAVE_sleu && HAVE_sge && HAVE_sgeu)
  5690.     {
  5691.       comparison = compare (exp, LE, LEU, GE, GEU);
  5692.       icode = CODE_FOR_sle;
  5693.       compare_mode = insn_operand_mode[(int) CODE_FOR_sle][0];
  5694.     }
  5695.       break;
  5696.  
  5697.     case GE_EXPR:
  5698.       if (HAVE_sle && HAVE_sleu && HAVE_sge && HAVE_sgeu)
  5699.     {
  5700.       comparison = compare (exp, GE, GEU, LE, LEU);
  5701.       icode = CODE_FOR_sle;
  5702.       compare_mode = insn_operand_mode[(int) CODE_FOR_sle][0];
  5703.     }
  5704.       break;
  5705. #endif
  5706.     }
  5707.   if (comparison == 0)
  5708.     return 0;
  5709.  
  5710.   if (target == 0 || GET_MODE (target) != mode
  5711.       /* Don't use specified target unless the insn can handle it.  */
  5712.       || ! (*insn_operand_predicate[(int) icode][0]) (target, mode)
  5713.       /* When modes don't match, don't use specified target,
  5714.      because it might be the same as an operand,
  5715.      and then the CLOBBER output below would screw up.  */
  5716.       || (mode != compare_mode && GET_CODE (comparison) != CONST_INT))
  5717.     target = gen_reg_rtx (mode);
  5718.  
  5719.   /* Store the comparison in its proper mode.  */
  5720.   if (GET_CODE (comparison) == CONST_INT)
  5721.     emit_move_insn (target, comparison);
  5722.   else if (GET_MODE (target) != compare_mode)
  5723.     {
  5724.       /* We want a different mode: store result in its natural mode.
  5725.      Combine the mode conversion with the truncation we must do anyway.  */
  5726.       /* Put a CLOBBER before the compare, so we don't come between
  5727.      the compare and the insn that uses the result.  */
  5728.       emit_insn_after (gen_rtx (CLOBBER, VOIDmode, target), prev_insn);
  5729.       emit_insn ((*setcc_gen_fctn[(int) GET_CODE (comparison)])
  5730.          (gen_rtx (SUBREG, compare_mode, target, 0)));
  5731.       /* If the desired mode is wider than what we got,
  5732.      use an AND to convert it, but not if we will do one anyway.  */
  5733. #if STORE_FLAG_VALUE == 1
  5734.       if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (compare_mode))
  5735.     expand_bit_and (mode, target, const1_rtx, target);
  5736. #endif
  5737.     }
  5738.   else
  5739.     emit_insn ((*setcc_gen_fctn[(int) GET_CODE (comparison)]) (target));
  5740.  
  5741. #if STORE_FLAG_VALUE != 1
  5742. #if STORE_FLAG_VALUE & 1
  5743.   expand_bit_and (mode, target, const1_rtx, target);
  5744. #else
  5745.   expand_shift (RSHIFT_EXPR, mode, target,
  5746.         build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0),
  5747.         target, TRUE);
  5748. #endif
  5749. #endif
  5750.   return target;
  5751. }
  5752.  
  5753. /* Generate a tablejump instruction (used for switch statements).  */
  5754.  
  5755. #ifdef HAVE_tablejump
  5756.  
  5757. /* INDEX is the value being switched on, with the lowest value
  5758.    in the table already subtracted.
  5759.    RANGE is the length of the jump table.
  5760.    TABLE_LABEL is a CODE_LABEL rtx for the table itself.
  5761.  
  5762.    DEFAULT_LABEL is a CODE_LABEL rtx to jump to if the
  5763.    index value is out of range.  */
  5764.  
  5765. void
  5766. do_tablejump (index, range, table_label, default_label)
  5767.      rtx index, range, table_label, default_label;
  5768. {
  5769.   register rtx temp;
  5770.  
  5771.   emit_cmp_insn (range, index, 0, 0, 0);
  5772.   emit_jump_insn (gen_bltu (default_label));
  5773.   /* If flag_force_addr were to affect this address
  5774.      it could interfere with the tricky assumptions made
  5775.      about addresses that contain label-refs,
  5776.      which may be valid only very near the tablejump itself.  */
  5777.   index = memory_address_noforce
  5778.     (CASE_VECTOR_MODE,
  5779.      gen_rtx (PLUS, Pmode,
  5780.           gen_rtx (MULT, Pmode, index,
  5781.                gen_rtx (CONST_INT, VOIDmode,
  5782.                 GET_MODE_SIZE (CASE_VECTOR_MODE))),
  5783.           gen_rtx (LABEL_REF, VOIDmode, table_label)));
  5784.   temp = gen_reg_rtx (CASE_VECTOR_MODE);
  5785.   convert_move (temp, gen_rtx (MEM, CASE_VECTOR_MODE, index), 0);
  5786.  
  5787.   emit_jump_insn (gen_tablejump (temp, table_label));
  5788. }
  5789.  
  5790. #endif /* HAVE_tablejump */
  5791.